--- "kapil.V" <[EMAIL PROTECTED]> wrote: > Hi, > su-2.05b# df -h . > Filesystem Size Used Avail Capacity Mounted on > /dev/ad0s1e 136G 102G 23G 82% /home > > From my script I do: > my $du = qx#df -h \.#; > ($total,$used) = $du =~ /([0-9]+(\.[ 0-9]+)?)[ > M|G]/sg; > print "Total:$total\nUsed:$used\ n"; > > Output: > Total:136G > Used: > > Why is "$used" not set? >
For this case,using 'split' instead of regex is better I think. $ perl -e 'my $df="/dev/ad0s1e 136G 102G 23G 82% /home";my ($total,$used)=(split/\s+/,$df)[1,2];print "$total $used"' 136G 102G ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/