in reply to Sub Routine Malfunction

All above are still too complicated. Even a hash is not needed. What you need is just this:
#!/usr/bin/perl my @list=(qw/zero one two three four five six seven eight nine/); print "give the input:"; my $in=<STDIN>; print "$list[$in]\n";
As perl can automatically transform string to integer.

Replies are listed 'Best First'.
Re^2: Sub Routine Malfunction
by apl (Monsignor) on Aug 29, 2008 at 11:56 UTC
    You have a problem if $in is 75, -8, or Platypus.

    Defensive programming is good programming!
Re^2: Sub Routine Malfunction
by koolgirl (Hermit) on Aug 29, 2008 at 12:16 UTC
    Wow++, very nice ;) I learn something new with every reply, or rather, I guess, a new way of approaching the problem. I appreciate that, from all of the Monks, because it broadens not just my knowledge, but my perspective, which enables me to begin to design my programs more efficiently. Anyone can study a bit and write some code, it's being able to design the structure of it to do what is needed well, not just to do what is needed, that begins to breed a truly talented programmer . Thank you so much for furthering my ability to learn how to do just that :)