in reply to Match and Assign Problem
Change:
my $totmem = $OVERALL_MEM =~ /(\d+)/;
to:
my ($totmem) = $OVERALL_MEM =~ /(\d+)/;
For example:
use warnings; use strict; my $OVERALL_MEM = 'MemTotal: 148704012 kB MemFree: 32165204 kB'; my ($totmem) = $OVERALL_MEM =~ /(\d+)/; print "totmem is : $totmem"; print "\n"; __END__ totmem is : 148704012
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Match and Assign Problem
by intoperl (Acolyte) on Aug 26, 2015 at 14:48 UTC |