[CrackMonkey] Perl

Martin Pool mbp at linuxcare.com.au
Sun Jan 21 20:04:39 PST 2001


On 14 Jan 2001, Ben Brockert <benb at iastate.edu> wrote:
> Could one of you geniuses give me a hand?
> 
> I have a scalar, lets call it $foo. Sample text in foo could be
> 
> BAR H
> QUUX
> BAZ BIM
> 
> I want to take that, do some magic regexp stuff on it, and end up with
> 
> Bar H
> Quux
> Baz Bim
> 
> (this is a scalar, not an array, those are different samples, not
> different elements).

By contrast, in Python:

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

> My perl is ugly.

Everybody's Perl is ugly.

-- 
Martin Pool





More information about the Crackmonkey mailing list