dominix has asked for the wisdom of the Perl Monks concerning the following question:

making some test using one-liner, I've hit this :
perl -le "print join ' ', map{ucfirst} split / /, 'toto fait du velo' +" Toto Fait Du Velo ... sound like what I expected ... perl -MO=Deparse -le "print join ' ', map{ucfirst} split / /, 'toto fa +it du velo' " BEGIN { $/ = "\n"; $\ = "\n"; } print join(' ', map({ucfirst $_;} split(/ /, 'toto fait du velo', 0))) +; -e syntax OK perl -le "print join(' ', map({ucfirst $_;} split(/ /, 'toto fait du v +elo', 0)));" Toto Fait Du Velo Toto Fait Du Velo Toto Fait Du Velo Toto Fait Du Velo 1 1 1 1
if I replay it I've got plainty more lines
it look like {ucfirst} and {ucfirst $_} are not considered the same.
...
can someone explain me what I'm missing ?
--
dominix

Replies are listed 'Best First'.
Re: ucfirst strangeness
by PodMaster (Abbot) on Nov 01, 2004 at 10:04 UTC
    You're not the first and you won't be the last to be bit by shell interpolation. Try
    perl -le "print join(' ', map({ucfirst \$_;} split(/ /, 'toto fait du +velo', 0)));"
    instead.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.