#!/usr/bin/perl use strict; use warnings; my %data = ( "blah"=>1, "boo"=>2, "hoo"=>3 ); # assign each key to a package variable of the same name foreach (keys %data) { no strict 'refs'; ${"main::$_"} = $data{$_}; } # end-foreach # note, this causes a "used only once" warning as the symbolic reference # above doesn't count. Irrelevant for this example. print $main::blah; exit;