use strict; my %menu; my @array = ( 'Main//Reviews//PC', 'Other Menu//Other//Sub//Menus', 'Main//News', 'Main//Reviews//PS2', 'Main//Reviews//XBox', ); for (@array) { $_ =~ s/^/\$menu{'/; $_ =~ s/\/\//'}->{'/g; $_ =~ s/$/'}/; eval "$_ = 1"; } list_em(\%menu); sub list_em { my $ref = shift; if (ref($ref) eq 'HASH') { print "