#!/usr/bin/perl %hash = ( 1 => 5, 2 => 10, 3 => 15, 4 => 20 ); delete( $hash{2} ); foreach $x ( keys( %hash ) ) { print "$x = $hash{$x}\n"; } # output: # 1 = 5 # 3 = 15 # 4 = 20