in reply to Re^2: Regex to ignore comment
in thread Regex to ignore comment

Why don't you just strip off everything starting with #?

$line =~ s!#.*$!!; # strip off comments my( $key, $value ) = split /=/, $line;