Chas Owens am Freitag, 6. April 2007 13:27:
> On 4/6/07, D. Bolliger <[EMAIL PROTECTED]> wrote:
>
> > $ perl -nle 'print join " ", map ucfirst, map lc, split' < in.txt >
> > out.txt
>
> There is no need to have multiple maps and the @ARGV/<> trick handles
> files as well as stdin, so there is no need to use <
>
> perl -lne 'print join " ", map { ucfirst lc } split' in.txt > out.txt

You're right of course; your corrected version is not only more elegant and 
perlish, but also - what a surprise ;-) - significantly faster.

(I wondered how much:

           Rate twomaps  onemap
twomaps 13003/s      --    -26%
onemap  17668/s     36%      --

including assignement of the test data to $_ for split (~1250000/s), 
excluding print)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to