Re: [MacPerl-Porters] fiddling around with a commify sub, and found this.. bug?
[email protected] ("Scott R. Godin") Sat, 17 Nov 2001 16:43:04 -0500
| Newsgroups | perl.macperl.porters |
|---|---|
| Organization | Laughing Dragon Services |
| Message-ID | <[email protected]> |
In article <p05100301b81c09858426@[10.0.1.177]>, [email protected] (Chris Nandor) wrote: > > However, since you are not doing math, a simple quoting in your example > script will solve the problem. simply return reverse "$tmp" ? no wait, that doesn't work.. ahh, this works. sub commify ($@) { my $sep = shift; my @input = map { my $tmp = reverse; $tmp =~ s<(\d\d\d)(?=\d)(?!\d*\.)><$1,>g; $tmp = reverse $tmp; } @_; return join("$sep", @input); } ok, so, IMHO someone should let them know that perhaps "scalar reverse" isn't the best way to go with the example in perlfaq5. =8) ya think? > Also, look in perlfaq5 for examples of a commify() function. they *do* look suspiciously similar don't they? ;-) I can't imagine why... *100% completely innocent angelic look (99% margin for error)* O :) -- Scott R. Godin | e-mail : [email protected] Laughing Dragon Services | web : http://www.webdragon.net/ It is not necessary to cc: me via e-mail unless you mean to speak off-group. I read these via nntp.perl.org, so as to get the stuff OUT of my mailbox. :-)