foreach (@array){ print "$_\n"; } foreach (sort keys %hash){ print "$_ $hash{$_}\n"; }