in reply to matching between 1 to 8 digits but not more

Assuming you mean you don't want more than 8 digits in a row:
if ($Number =~ /\d{9}/) { print "Line has more than 8 digits!\n" } elsif ($Number =~ /\d/) { $N = $Number; } else { print "Line has no digits at all!\n"; }

Replies are listed 'Best First'.
Re^2: matching between 1 to 8 digits but not more
by Anonymous Monk on Aug 21, 2009 at 14:12 UTC
    If you don't care about consecutiveness:

    $digits = () = 'a1b2c3d4 e5f6g7h8i9' =~ /\d/g;