use strict; use Data::Dumper; # Uh, well spotted, typo fixed with the extra + # which would have no effect anyway. :-) # ysth suggested that putting () in map shortcircuts # empty lines. It worked. Thanks. :-) # Wow, even better, dropped that testing bit. #my %hostlist = map { /^(\w+)\s(.*)/?($1,$2):() } (); my %hostlist = map { /^(\w+)\s(.*)/ } (); print Dumper(\%hostlist); __DATA__ host1 1.1.1.1 host2 1.2.3.5