sub _split_options { my ($opts) = @_; while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } print("\n"); while (my ($k, $v) = each %$opts) { print "$k = $v\n"; } } my %opts = qw( a 1 b 2 c 3 d 4 ); scalar each %opts; _split_options(\%opts);