while () { chomp; # split the line from the spaces my ($file, $info) = split(/\s+/, $_, 2); # is it a range or a single line? if ($info =~ /(\d+)-(\d+)/) { $changes{$file} = [$1, $2]; } else { $changes{$file} = [$info]; } }