Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Presenting a local listing of remote files over HTTP

by hacker (Priest)
on Jul 03, 2002 at 19:45 UTC ( [id://179281]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179281]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found