in reply to strawberry on XP
Your program:
use strict; use warnings; use Benchmark; my @junk = `cat /etc/motd`; # not available on windows my $count = 10_000; timethese($count, { 'map' => sub { my @a = @junk; map { s/a/b/ } @a; return @a }, 'for' => sub { my @a = @junk; for (@a) { s/a/b/ }; return @a }, } ); # "my $var = defined(<STDIN>)";
wouldn't work because there's no cat and no /etc/motd available on your box (probably)
Other reasons: there were loads of typos (corrected).
Regards
mwa
|
---|
In Section
Seekers of Perl Wisdom