in reply to Re: Regex not greedy enough
in thread Regex not greedy enough

If you want to capture to the end of the line, in /m mode, $ anchors at the end of a line. In /s mode, ^ matches at the beginning of the string and $ matches at the end. So maybe you did want /m. Of course, you can also just do something like these:
while (<DATA>) { my ($key, $value) = /(\S+) (.*)/ or next; # or: my ($key, $value) = split; # or: (undef, $key, $value) = split(/\s+/, $_, 3); $hash{$key} = $value; # or: push(@{$hash{$key}}, $value); }
Untested, but you might get some ideas from that.