I have a bunch of matches that I need to make, and they all use the same code, except for the name of the file to read from, and the regexp itself. Therefore, I want to turn the match into a procedure that just accepts the filename and regexp as a string. When I use the variable to try to match, though, the special capture variables stopped being set.
$line =~ /(\d+)\s(\d+)\s/;
That code sets $1 and $2 correctly, but the following leaves them undefined:
$regexp = "/(\d+)\s(\d+)\s/";
$line =~ /$regexp/;
Any ideas how I can get around this?
Thanks, Jared