#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; my $x; # $x is undef my $y; # $y is undef too my %hash; $hash{$x} = 123; # This will throw warnings, but both $hash{$x} and $hash{$y} are 123 printf "\$hash{\$x} = %s; \$hash{\$y} = %s\n", $hash{$x}, $hash{$y}; print "Keys of \$hash => %s\n", Dumper([keys %hash]); __END__ Output: Use of uninitialized value in hash element at x line 11. Use of uninitialized value in hash element at x line 11. Use of uninitialized value in hash element at x line 14. Use of uninitialized value in hash element at x line 14. $hash{$x} = 123; $hash{$y} = 123 Keys of $hash => $VAR1 = [ '' ];