use strict; use warnings; my $str = "1 2=3 4=5"; print "$str\n"; my @strs = $str =~ m/(\w+=\w+)/g; print "$_\n" foreach @strs; #### 1 2=3 4=5 2=3 4=5