[CrackMonkey] Perl

Ben Brockert benb at iastate.edu
Sun Jan 14 13:00:45 PST 2001


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).

So far, the closest I have gotten is something like this:

   $foo=~tr/A-Z/a-z/;
   $class=ucfirst($class);
or
   $foo=~tr/A-Z/a-z/;
   $class=~tr/^[a-z]/[A-Z]/;
which yield the same output:

Bar h
Quux
Baz bim

Any bright ideas?

My perl is ugly.

And why did TPGTB[1] put ucfirst() in when tr/^[a-z]/[A-Z]/ does the same?

Ben

[1] TPerlGodsTB





More information about the Crackmonkey mailing list