in reply to Difference between piped-in and invocation arguments to a Perl script?

Simple but subtle = @ARGV != STDIN. The difference is that arguments are fed to the program at initialization time = they make up the values of the automatic @ARGV array - while STDIN is what is fed into a program *after* initialization via pipes, user input, or other redirects. So, if you want to pipe output to a perl app, use the <STDIN> filehandle to capture it, like so:
#!/usr/bin/perl -w my $line = <STDIN>; print "Line is: " . $line; $ echo 'echo' | ./teststdin.pl Line is: echo
This also works for redirecting files:
$ cat echo.txt echoed file $ ./teststdin.pl < echo.txt Line is: echoed file
Hope this helps!