[Chicago-talk] Piping a command into perl?

Don Drake don at drakeconsult.com
Sat Mar 18 15:09:31 PST 2006

This will work...


while (<STDIN>) {
        print $_;


-----Original Message-----
From: chicago-talk-bounces+don=drakeconsult.com at pm.org
[mailto:chicago-talk-bounces+don=drakeconsult.com at pm.org] On Behalf Of Jay
Sent: Saturday, March 18, 2006 4:59 PM
To: Chicago.pm chatter
Subject: Re: [Chicago-talk] Piping a command into perl?

On Saturday 18 March 2006 4:55 pm, Andy Lester wrote:
> On Mar 18, 2006, at 4:50 PM, Jay Strauss wrote:
> > How would I pipe a command into perl?
> >
> > for example:
> >
> > $ echo "Hello\n" | perl
> >
> >
> > doesn't work.  But I'd like to do something like that
> What would you expect that to do?

I'd like it to print Hello

I know I can do similar with -e, but I'm calling perl from inside a bash 
script, and I have a bash variable with a bunch of perl code in it.

so I'd like to do:

$results=echo $bash_var | perl

Chicago-talk mailing list
Chicago-talk at pm.org

More information about the Chicago-talk mailing list