Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w $a1 = 1; $a2 = 2; $a3 = 3; $b1 = 4; $b2 = 5; $b3 = 6; $c1 = 7; $c2 = 8; $c3 = 9; %squares = ("a1", $a1, "a2", $a2, "a3", $a3, "b1", $b1, "b2", $b2, "b3 +", $b3, "c1", $c1, "c2", $c2, "c3", $c3); print "Remove which one? "; chomp ($response = <STDIN>); make_blank(); print values %squares; print "\n"; print %squares; # makes the moved piece blank sub make_blank() { foreach $key (keys %squares) { ($squares{$key} .= "") if ($key eq $response); } }
edit by thelenm: changed title from "Newbie question"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Newbie question
by jdtoronto (Prior) on Sep 17, 2003 at 18:53 UTC | |
|
Re: Newbie question
by dsb (Chaplain) on Sep 17, 2003 at 18:59 UTC | |
|
Re: Newbie question
by tcf22 (Priest) on Sep 17, 2003 at 19:19 UTC | |
|
Re: Newbie question
by Plankton (Vicar) on Sep 17, 2003 at 18:55 UTC | |
|
Re: Newbie question
by blue_cowdawg (Monsignor) on Sep 17, 2003 at 18:48 UTC | |
by Anonymous Monk on Sep 17, 2003 at 18:51 UTC |