intoperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks - I have a prblem going for match and assign statement. The result i get in $totmem, $freemem and $memdiff is Zero '0'. The Variables $OVERALL_MEM, and $OVERALL_MEM_FREE has value in the form like below: MemTotal: 148704012 kB MemFree: 32165204 kB Please see the code snippet below to see what possible error i made :

my $totmem = $OVERALL_MEM =~ /(\d+)/; print "totmem is : $totmem"; my $freemem = $OVERALL_MEM_FREE =~ /(\ +d+)/; print "freemem is : $freemem"; my $memdiff = $totmem - $freemem; print "Memdiff is :$memdiff KB ";

Replies are listed 'Best First'.
Re: Match and Assign Problem
by toolic (Bishop) on Aug 26, 2015 at 14:32 UTC

      Thanks Toolic, that helped ! :)

Re: Match and Assign Problem
by neilwatson (Priest) on Aug 26, 2015 at 18:55 UTC