in reply to Simple re question
which is equivalent to$line=/-\s/;
Here's an easier way to get what you want, assuming that you want to match from the first hyphen to the first closing brace after that hyphen:$line = ($_ =~ /-\s/);
my ($excerpt) = $line =~ /-([^)]+\))/;
The variable $excerpt will now hold the value you want, without having to monkey around with the magic $` and $' variables (which impose a performance penalty on your entire program). You also go down from three matches to one.
|
|---|