in reply to Strange "Useless use of constant" message: should not appear at all!
is equivalent toif (@movement == (0, 1)) {$from = "north"}
if (@movement == ($any_other_value, 1)) {$from = "north"}
You probably want something like
This also solves your warning by the way.my $from = ""; if ($movement[0] == 0 && $movement[1] == 1) {$from = "north"} elsif ($movement[0] == 1 && $movement[1] == 0) {$from = "east"} elsif ($movement[0] == 0 && $movement[1] == -1) {$from = "south"} elsif ($movement[0] == -1 && $movement[1] == 0) {$from = "west"}
Hope this helps
Joost
|
|---|