Perl Monk, Perl Meditation | |
PerlMonks |
Re: Read into stdin pipe charactersby dasgar (Priest) |
on Oct 05, 2010 at 23:09 UTC ( [id://863703]=note: print w/replies, xml ) | Need Help?? |
First, I'm going to assume that you're running on a *nix platform based off of your shebang line. To call your script, you do have to encapsulate the desired pipe character inside of quotes. If you don't, the shell with believe that the pipe character is telling it to do something. Also, encapsulating it in quotes will not pass the quotes to your script. For example, let's say you try calling your program like this: perl script.pl b c|d|e|f. Here's how your shell will process that.
In this case, I'd agree with ReturnOfThelonious that the error is from the shell and not your script. If you were instead to call your script like this : perl script.pl b "c|d|e|f", here's how your shell would process it.
Notice the lack of quotes in the last step? The quotes will basically tell the shell: "Hey, treat everything in side this quote as a parameter and DO NOT view this content as instructions for you to do". The quotes are not actually passed by the shell into your script. This is why toolic suggested that you "quote your passed strings". I apologize for the length of this post. But since you didn't seem to quite understand what toolic was suggesting, I thought I'd go the extra length to clearly explain the quoting from the shell's perspective.
In Section
Seekers of Perl Wisdom
|
|