in reply to Regex to extract digits
There are at least three different sensible ways plus a few silly ones.
$str = "1234-56"; # you can split on the '-' - the second bit is what we want..... my (undef, $digits) = split '-', $str; # you can use index to get the position in the string of the '-' # and substr to get the 2 chars just past that position..... $digits = substr $str, index($str, '-')+1, 2; # you can use an RE..... ($digits) = $str =~ m/\-(\d\d)/;
cheers
tachyon
|
|---|