[CrackMonkey] Perl

David Huggins-Daines dhd at eradicator.org
Sun Jan 14 13:23:30 PST 2001


Ben Brockert <benb at iastate.edu> writes:

> Could one of you geniuses give me a hand?

You're really just asking to get flamed, aren't you?  I mean, why else
would you ask a really simple programming question on this list?

Okay, well, I humbly accept.

> 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?

Use the FAQ, dumb-ass.  Here's a hint, it's in perlfaq4(1p).

> My perl is ugly.

Did you mean '[my perl] is ugly' or '[my], perl is ugly'?

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

Fucking hell, didn't you ever use sed(1) when you were a kid?  You
should know that tr/// and s/// do different things and have totally
different syntax.  That tr/// command works only by pure chance on
your part.

Now, substituting 's' for 'tr' in that question, I suspect it's under
the "why waste zillions of cycles and bytes compiling and executing a
regular expression when you can just flip a bit in the first character
of a string" rule.

> [1] TPerlGodsTB

WTF is 'TB'?  ITYM TM, HTH, HAND

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





More information about the Crackmonkey mailing list