Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: GB, MB, KB and on..

by glenn (Scribe)
on Oct 21, 2013 at 13:12 UTC ( #1059107=note: print w/replies, xml ) Need Help??


in reply to Re: GB, MB, KB and on..
in thread GB, MB, KB and on..

Fix if size is larger than PB. <code> sub prettyBytes { my $size = $_[0]; foreach ('b','kb','mb','gb','tb','pb') { last if $size < 1024; $size /= 1024; } return sprintf("%.2f",$size)."$_"; } <code>

Replies are listed 'Best First'.
Re^3: GB, MB, KB and on..
by hdb (Monsignor) on Oct 21, 2013 at 14:31 UTC

    This does not work as expected as the value of $_ is undefined outside of the loop.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2022-01-17 02:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (50 votes). Check out past polls.

    Notices?