Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Read into stdin pipe characters

by toolic (Bishop)
on Oct 05, 2010 at 20:07 UTC ( #863670=note: print w/replies, xml ) Need Help??

in reply to Read into stdin pipe characters

Maybe you need to quote your passed strings. For example:
C:\> a b "c|d|e|f"

Also, you really want:

$stuff = $ARGV[2];

Replies are listed 'Best First'.
Re^2: Read into stdin pipe characters
by w3ntp (Beadle) on Oct 05, 2010 at 20:16 UTC
    This input string does not contain quotes. Otherwise this would be easy

      You seem to be confusing the string and the literal (piece of shell code) that produces the string.

      The string may not have quotes, but the shell string literal that produces the string must use quotes or some alternative. For example, with bash, you could use any of the following shell commands: a b 'c|d|e|f' a b "c|d|e|f" a b c\|d\|e\|f

      In all cases, a string of four letters separated by pipes will be passed to Perl by the shell. print $ARGV[2] will result in the following:

      First, please use <code> tags for your code. It's very, very difficult to read your program.

      Are you sure the error is coming from perl? How are you passing pipe characters on the command line if you're not using quotes?

      Also, please "use strict;" and "use warnings;" before posting:

      #!/usr/local/bin/perl use strict; use warnings; my $stuff = $ARGV[2]; print $stuff; exit;


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863670]
[erix]: sounds cool -- but now you have to give SQL lessons?

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2018-07-18 13:09 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (392 votes). Check out past polls.