sub parse_commands { my ($filename) = @_; my $fh = IO::File->new($filename) || die ...; while (<$fh>) { # All commands being with a letter and must be the first character next if /^[^A-Za-z]/; # A command is space-delimited and must be on one line. # We want to deal with the entire command in uppercase. my ($command, @line) = split /\s+/, uc; unless (exists $DispatchTable{$command}) { warn "'$command' isn't a valid command.\n"; next; } push @commands, [$command, \@line]; } return \@commands; }