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

sub commify { my $text = reverse $_[0]; $text =~ s/(\d{3})(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }
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/

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
    Eh? Doesn't the last line reverse the reversal from the first one, maybe?

    Makeshifts last the longest.