in reply to Hash of Hashes: Get the next Key without foreach loop

Your script reminds me of a Jackson's song. "Simple as 1-2-3, A-B-C!". It's a pneumonic that I've used to help me remember hash slices, which is what I believe that you're looking for.
#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; my %hash = (1 => 'A', 2 => 'B', 3 => 'C'); print "The first and second keys: hash slice ==> \n", Dumper( @hash{qw(1 2)} ); print "Just the third key: \n", Dumper( $hash{3} );
Note that I used @hash{qw(1 2)} to get at multiple keys; also, the keys must be quoted in slices.