in reply to Re^4: How can I test for the representation of an integer?
in thread How can I test for the representation of an integer?

If you want to know whether a regular expression matches, why not simply use the regular expression in boolean context? A regular expression can match a zero-width string, so testing $& won't always help. I would use something like the following:

my $regexp = 'hello.*world'; if( /$regexp/ ) { print "Your regexp '$regexp' matches '$_'\n"; for my $match ( 0..$#- ) { print sprintf "Match %02d (%d, %d):\t[%s]\n", $match, $-[$matc +h], $+[$match], substr( $_, $-[$match], $+[$match] ); }; };

But as you haven't told us what the overall problem is you're trying to solve, I might be wildly off the mark. Maybe read XY Problem and then restate the actual problem you're trying to solve. That might be easier to solve than removing the problem where your current approach becomes untractable.