in reply to converting "30k" string to integer
Updated - For case insensitivity, I simply added an i modifier on the regex, and of course the lc on the $2.s((\d+)([kmg]b?)){ $1 * ({ k => 1000, kb => 1024, m => 1000*1000, mb => 1024*1024, g => 1000*1000*1000, gb => 1024*1024*1024, })->{lc $2} }ie;
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: converting "30k" string to integer
by Anonymous Monk on May 16, 2003 at 12:32 UTC | |
by CombatSquirrel (Hermit) on May 16, 2003 at 13:35 UTC |