XP is just a number | |
PerlMonks |
Re: More Argumentsby Athanasius (Archbishop) |
on Sep 05, 2015 at 04:31 UTC ( [id://1141115]=note: print w/replies, xml ) | Need Help?? |
Hello joaming, To get the syntax right, you’ll need to study perlop#I/O Operators: The null filehandle <> is special: it can be used to emulate the behavior of sed and awk, .... Input from <> comes either from standard input, or from each file listed on the command line. Here's how it works: the first time <> is evaluated, the @ARGV array is checked, and if it is empty, $ARGV[0] is set to "-", which when opened gives you standard input.... By trial and error, I found the following (on Windows), which seems to do what you’re looking for:
The call to <> finds - as the first argument on the command line and so reads from standard input, which is Hello\n. After this, @ARGV is apparently reset. I haven’t found that behaviour documented (yet). Anyway, hope that helps,
In Section
Seekers of Perl Wisdom
|
|