regex - extracting numbers or changing them directly using perl -


$harddisk = `wmic logicaldisk size,caption`; 

contains following. want extract numbers, or change them directly

total hard disk capacity:  caption  size           c:       480737488896   d:       19157479424    e:                      f:          

would possible perhaps them using foreach+

foreach($harddisk =~ m/\d+/g){ push(@hdd, noideawhattoputhere; }

or perhaps possible use math in regex? here i'd want divide $1 1024.

$harddisk =~ s/(\d+)/$1/g; 

thanks in advance!

$harddisk =~ s|\d+|$&/1024|ge; 

the e modifier means treat substitution expression evaluate.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -