in reply to (jeffa) Re: Presenting a local listing of remote files over HTTP
in thread Presenting a local listing of remote files over HTTP
Except that your last line above actually reverses the size, so a file of 180,224 bytes becomes 422,081 bytes when returned from commify(). Easy fix: s/scalar reverse/scalar/sub commify { my $text = reverse $_[0]; $text =~ s/(\d{3})(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }
Great tip, and benches a few millis faster in execution time on longer file listings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Presenting a local listing of remote files over HTTP
by Aristotle (Chancellor) on Jul 04, 2002 at 03:40 UTC |