my ($num) = $string =~ /(\d+)/; # Added $num += 0;
$num is in parens to put the right side into list context, which makes match return the value matched.
After Compline,
Zaxo
In reply to Re: Extracting a number from a string
by Zaxo
in thread Extracting a number from a string
by blax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |