my @errors = qw(arg1=1 arg2=2 arg3=3); my %errors; foreach my $error (@errors) { my @temp = split(/=/, $error); $errors{$temp[0]} = $temp[1]; } %errors2 = map {split /=/,2} @errors; # thanks, Chmrr