in reply to Help with a regex
Your substr didn't work because the code doesn't check to see if rindex found the '.' it was looking for. If you do that, you don't need a regexp at all.
if ((my $last_dot = rindex($string, '.')) > -1) { $result = substr( $string, 0, $last_dot + 1 ); }
... just in case you wanted to know why your code wasn't working as expected.
• another intruder with the mooring in the heart of the Perl
|
|---|