QUOTE(KevinADC @ 1 Jul, 2009 - 06:20 PM)

The regexp might be better written like so:
CODE
if ($line=~ /^(.+?)=(.+?)$/) {
otherwise it could return undefined values for $1 and $2 since .*? can match nothing
Better still:
CODE
if ($line=~ /^([^=]+)=(.*)$/) {
For the first match, if you only want non-= characters, then ask for "only non-= characters", not "the shortest possible sequence of characters which is followed by an =". Aside from being more explicit about what you want, using the negated character class also completely eliminates any possibility that the regex engine could get confused on certain input strings and start backtracking in search of a better match.
For the second match, there's no point in making a match-to-end-of-line non-greedy. It can't match without consuming everything anyhow.
(Perhaps I should add "campaigner against abuse of non-greedy . in regex" to my forum signature... Or maybe "Knight of the Negated Character Class" sounds better...)