use strict; use warnings; use Data::Dumper; my %hash = map { split; $_[1] => $_[0] } "value key", "meaning-of-life 42"; print Dumper( \%hash );