in reply to Can I empty a hash value?

Before you assign an empty string to the hash, you should check to see if it exists. If it doesn't, it will create that hash entry, and if you ever loop though the keys, you will get a user entered key. Which, I would assume you don't want.

Also, you probably should use strict and just pass the user input into the make_blank() function.
#!/usr/bin/perl -w use strict; my %squares = ( a1 => $a1, a2 => $a2, a3 => $a3, b1 => $b1, b2 => $b2, b3 => $b3, c1 => $c1, c2 => $c2, c3 => $c3 ); my $response = <STDIN>; chomp ($response); &make_blank(\%squares, $response); print values %squares; print "\n"; print %squares; # makes the moved piece blank sub make_blank() { my $sq_hashref = shift; my $res = shift; if(exists $sq_hashref->{$res}){ $sq_hashref->{$res} = ''; } }

- Tom