use warnings; use strict; my $str = do {local $/; }; my @matches = $str =~ /(\w+):(.*)/g; print "@matches\n"; __DATA__ 1: one 2: two 3: three #### 1 one 2 two 3 three