in reply to Re: (jeffa) Re: simple menu loop problems
in thread simple menu loop problems

Hey ddrumguy! (got your email BTW ;))

  1. Yes. while(1) is saying while TRUE ... the reason i use that is because Perl has the last token to exit. I used to be afraid of while(1) loops, but i like them now.
  2. menu() is just calling the menu subroutine. tye gets on to me for calling subs this way ... a more proper way would be to use the ampersand: &menu(). The main reason i can think of is ... what if a new built-in function named menu is introduced? Then menu() would call it, not the one you declared - but &menu() will call yours.
  3. Last item ... hehehe sorry about that. How about this instead:
my $total_choices = $#choice; for my $index (0..$total_choices) { print $index + 1, ": $choice[$index]\n"; }
Same thing ;)

Keep it up, you'll be coding map's and grep's and Schwartzian Transforms in no time. ;)

Still get good ddrum offers? ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)