[EMAIL PROTECTED] (Pete Sergeant) writes:
> sub commify {
> my $number = $_[0]; # Grab the first argument passed
> while ($number =~ s/^([-+]?\d+)(\d{3})/$1,$2/) {;}
> return $number;
> }
>
> Perhaps it's not very 31337, but it gets its job done, and should be
> understandable - we'd hate to breed more blind cargo-cult-coders, wouldn't
> we?
1 while (...) is a fairly common Perl idiom. If you do Perl for a
while you'll run into it.
Using {;} for a NOP is rare. I had to read it over several times while
wondering why you obscured it before realizing what was going on. :-)
replacing "local $_ ..." with my "$number = shift;" makes sense
though.
In fact, I just abused my access to cvs.perl.org to give myself commit
access and commit such a change:
http://cvs.perl.org/cgi/cvsweb.cgi/perlfaq/perlfaq5.pod.diff?r1=1.1&r2=1.2
Comments welcome. I might just be brainwashed into disliking local.
=)
- ask
--
ask bjoern hansen, http://ask.netcetera.dk/ !try; do();