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
Post a Comment