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

Passing a value as an argument (@ARGV) is not the same as reading from stdin, try:
#!/usr/bin/perl use warnings; use strict; my $value; if (defined $ARGV[0]) { $value = $ARGV[0]; } else { $value = <STDIN>; } print "<$value>\n";
Run that using your two methods, and note the difference. Also lookup chomp.
I hope that helps.
  • Comment on Re: Difference between piped-in and invocation arguments to a Perl script?
  • Download Code