in reply to Re^2: How to read the file from stdin using perl?
in thread How to read the file from stdin using perl?
No. I am suggesting to read the filehandle STDIN as you do with your filehandle F - via the diamond operator "<>" or readline. No need to pass STDIN anywhere.
$| = 1; # turn on autoflush print "Enter file name: "; my $answer = <STDIN>; chomp $answer; # remove newline char from answer print "file name is '$answer'\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to read the file from stdin using perl?
by gopikavi (Initiate) on May 09, 2017 at 10:02 UTC | |
by AnomalousMonk (Archbishop) on May 09, 2017 at 14:48 UTC |