in reply to array games??

gjb got it basicly right -- except he seems to have missed the part where your code said:  my $action = <>;

(But you should notice that this line "masks" (renders irrelevant) an earlier declaration of  my $action; that appears before the call to "main()" -- maybe this was intentional, but I wonder... and "perl -w" won't warn you about it, because the second "my $action" is within a subroutine.)

Anyway, saying while (<1>) (with angle brackets inside parens), will fail, because you have not opened a file handle named "1".