in reply to parameters and piped input

You can strip the args you want out of @ARGV before using <>:

$num = shift @ARGV; while (<>) { ... process data ... }

Or if you don't want any automatic processing of file arguments, you can just read from <STDIN> instead of <>.