in reply to Re: using switch
in thread using switch

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: using switch
by castaway (Parson) on Sep 29, 2005 at 16:11 UTC
    Sounds like you just need to use dispatching. i.e. make a hash which contains the possible commands/directions as keys, and has strings to output as values. (Or probably more useful, has coderefs as values to be run)

    C.

Re^3: using switch
by sgifford (Prior) on Sep 29, 2005 at 16:10 UTC
    Just use several if statements:
    if ($DIRECTIONS eq 'NORTH') { print "$HERONAME HAS LEFT NORTH\n" } elsif ($DIRECTIONS eq 'SOUTH') { print "$HERONAME HAS LEFT SOUTH\n" } elsif ($DIRECTIONS eq 'EAST') { print "$HERONAME HAS LEFT EAST\n" } elsif ($DIRECTIONS eq 'WEST') { print "$HERONAME HAS LEFT WEST\n" }