in reply to parameters and piped input

Since you want to read from standard input, you could use STDIN:

num = @ARGV[0]; while (<STDIN>) { (parser algorithm) } print ("$result");