my $v1 =0;
my $v2=0;
# match all lines that end with two numbers
# (note: only unsigned integers are matched, not floats like 2.3, -3.4, 2e-3 ...!)
if ($_ =~ m/.*/\s+(\d+)\s+(\d+)\s*$/)
{
$v1 = $1;
$v2 = $2;
if ( $v2 < 1) {
...
my $v1 =0;
my $v2=0;
# match all lines that end with two numbers
# (note: only unsigned integers are matched, not floats like 2.3, -3.4, 2e-3 ...!)
if ($_ =~ m/.*/\s+(\d+)\s+(\d+)\s*$/)
{
$v1 = $1;
$v2 = $2;
if ( $v2 < 1) {
...
To copy to clipboard, switch view to plain text mode
If you need to match not only integers the you need to replace the (\d+) by more complicated regexs for whatever numbers you need to match. See, e.g. http://docstore.mik.ua/orelly/perl/cookbook/ch02_02.htm
HTH
Bookmarks