[CrackMonkey] Perl

David Huggins-Daines dhd at eradicator.org
Mon Jan 22 04:29:47 PST 2001


Martin Pool <mbp at linuxcare.com.au> writes:

> By contrast, in Python:
> 
> from string import *
> for foo in ['BAR H', 'QUUX', 'BAZ BIM']:
>   print join(map(capitalize, split(foo)))

dhd at monolith:~$ cat bartest.py 
from string import *
for foo in ['BAR H', 'QUUX', 'BAZ BIM']:
  print join(map(capitalize, split(foo)))
dhd at monolith:~$ time python bartest.py
Bar H
Quux
Baz Bim

real    0m0.030s
user    0m0.030s
sys     0m0.000s

dhd at monolith:~$ cat bartest.perl 
foreach my $foo ('BAR H', 'QUUX', 'BAZ BIM') {
        print join ' ',
                map ucfirst(lc($_)),
                         split / /, $foo;
}
dhd at monolith:~$ time perl -l bartest.perl 
Bar H
Quux
Baz Bim

real    0m0.008s
user    0m0.010s
sys     0m0.000s

-- 
David Huggins-Daines		-		dhd at eradicator.org





More information about the Crackmonkey mailing list