justkar4u has asked for the wisdom of the Perl Monks concerning the following question:
The first two scenarios works fine.The piped input scenario works good if i just use it as a seperate perl script nd do test.pl < input.txt But when i try to combine it with above two scenarios it always enters the first case. I read somewhere that -t option is used to check if handle is open to tty and since piped inputs are supplied through stdin i thought this works but somehow it doesnt. I also tried using (*stdin) in the third case but it messes up the other two options ..Any sugestions ? - Thanks Ramif ($#ARGV == -1){..#no arguments passed.} elsif ($#ARGV == 1){..# arguments passed from command line.} elsif (-t STDIN and not @ARGV){..#piped inputs are supplied....do this +} else {default: usage error}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using PIped-in and invocation arguments in same script
by Eliya (Vicar) on Apr 07, 2011 at 20:17 UTC | |
by justkar4u (Novice) on Apr 08, 2011 at 02:05 UTC | |
|
Re: Using PIped-in and invocation arguments in same script
by wind (Priest) on Apr 07, 2011 at 19:44 UTC | |
by justkar4u (Novice) on Apr 08, 2011 at 02:03 UTC | |
|
Re: Using PIped-in and invocation arguments in same script
by Anonymous Monk on Apr 07, 2011 at 19:58 UTC | |
by justkar4u (Novice) on Apr 08, 2011 at 02:04 UTC | |
|
Re: Using PIped-in and invocation arguments in same script
by Anonymous Monk on Jan 24, 2013 at 13:28 UTC |