: can any one suggest me a REGEX to catch the numbers in the following
: input line:
: test case total : 32456 allocated : 12000 from tech
:
: I want to catch the two numbers and insert them to vars
Elegant? Regex? ;)
$line = 'test case total : 32456 allocated : 12000 from tech';
($n1,$n2) = $line =~ /\d+/g;
Explanation: The expression $line =~ /\d+/g returns a list of all the
matches. So assigning something to it gives you all the numbers in the
line. (Make sure you use the /g modifier.) Here we're only asking for
the first two.
-- tdk