#!/usr/bin/perl -w my $line = ; print "Line is: " . $line; $ echo 'echo' | ./teststdin.pl Line is: echo #### $ cat echo.txt echoed file $ ./teststdin.pl < echo.txt Line is: echoed file