|We don't bite newbies here... much|
Re: STDIN & STDOUT on Win32 ?by BrowserUk (Patriarch)
|on Mar 01, 2006 at 12:13 UTC||Need Help??|
If you have AS perl and/or their htmlized docset, then this is mentioned under the heading STDIN and STDOUT, and Piping don't always work on NT..
Although for my taste it doesn't explain the cause well or offer all the solutions.
If you want your program to be able to accept input from the command line or from a file specified on the command line, is to use the 'diamond operator' <> instead of <STDIN>:
However, that won't work for piping like this:
Instead you have to use
or use the AS solution, pl2bat(.bat) which can be found in x:\yourperl\bin, (assuming you have AS perl :)
What that does, is wrap yourscript.pl in some batch code and outputs it as yourscript.bat, which then allows you to use both
yourscript <file and
type file | yourscript syntaxes without decoration:
The downside of this is that if you edit yourscript.pl the changes do not get reflected into yourscript.bat unless you re-run the pl2bat. Which will give you a moment or twos pause for thought if you've forgotten that you converted a script to a .bat and you find that your edits to it don't seem to make any difference!
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.