#!/usr/bin/perl -wl use strict; my %h1; my %h2; @h1{1..10} = undef; print join " ", keys %h1; @h1{5..10, 1..4} = undef; print join " ", keys %h1; @h2{5..10, 1..4} = undef; print join " ", keys %h2; __END__ Prints: 1 2 3 10 4 5 6 7 8 9 1 2 3 10 4 5 6 7 8 9 1 2 3 4 10 5 6 7 8 9