#!/usr/bin/perl # http://perlmonks.org/?node_id=1176039 use strict; use warnings; my $Pipe = ''; if( -p STDIN ) { while( ) { $Pipe .= $_; } } print "This was read from the pipe:\n"; print "<$Pipe>\n\n"; print "This was the read from the parameters:\n"; print "<@{ARGV}>\n"; __END__ #### C:\test>ReadPipeAndArgs.pl A B CDE H 123 This was read from the pipe: <> This was the read from the parameters: #### C:\test>ReadPipeAndArgs.pl A B CDE H 123 < ReadPipeAndArgs.pl This was read from the pipe: <> This was the read from the parameters: #### C:\test>ReadPipeAndArgs.pl A B CDE H 123 < ReadPipeAndArgs.pl This was read from the pipe: <#!/usr/bin/perl # http://perlmonks.org/?node_id=1176039 use strict; use warnings; my $Pipe = ''; unless( -t STDIN ) { while( ) { $Pipe .= $_; } } print "This was read from the pipe:\n"; print "<$Pipe>\n\n"; print "This was the read from the parameters:\n"; print "<@{ARGV}>\n"; __END__ > This was the read from the parameters: C:\test>type ReadPipeAndArgs.pl | ReadPipeAndArgs.pl A B CDE H 123 This was read from the pipe: <#!/usr/bin/perl # http://perlmonks.org/?node_id=1176039 use strict; use warnings; my $Pipe = ''; unless( -t STDIN ) { while( ) { $Pipe .= $_; } } print "This was read from the pipe:\n"; print "<$Pipe>\n\n"; print "This was the read from the parameters:\n"; print "<@{ARGV}>\n"; __END__ > This was the read from the parameters: C:\test>ReadPipeAndArgs.pl A B CDE H 123 This was read from the pipe: <> This was the read from the parameters: