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