in reply to STDIN problemo
#!/usr/bin/perl my @piped = <STDIN>; print "last piped element: ".$piped[-1]; close STDIN; open STDIN, "<", "/dev/tty" or die "Couldn't open console: $!"; # "con" on Windows (IIRC) print "> "; my $user_input = <STDIN>; print "user input: ".$user_input; __END__ $ echo foo |./813419.pl last piped element: foo > bar user input: bar
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: STDIN problemo
by ww (Archbishop) on Dec 18, 2009 at 22:13 UTC | |
by ccdoub (Initiate) on Dec 19, 2009 at 03:27 UTC |