in reply to What is the output of perl command?

7stud,

I tried this on an AIX machine and a Debian Linux machine:

$ perl | ls
And in both cases I was surprised that the 'ls' executed and I had output, but Perl indeed did wait for input. I then typed a '{ }' and nothing happened. I had to '^C' to break out.

Interesting...

"Well done is better than well said." - Benjamin Franklin

Replies are listed 'Best First'.
Re^2: What is the output of perl command?
by cheekuperl (Monk) on Jun 16, 2012 at 11:01 UTC
    $ perl | ls
    ls does not need input to run. So, it ran and gave the output, perl still waiting for some input.
    Try
    $ perl | wc -l
    and you will see both perl and wc waiting for their respective inputs- perl from the user and wc from the pipe.
Re^2: What is the output of perl command?
by cheekuperl (Monk) on Jun 16, 2012 at 11:25 UTC
    but Perl indeed did wait for input. I then typed a '{ }' and nothing happened. I had to '^C' to break out.
    $PROMPT> perl <press enter key> $name="vaibhav"; print "\nName is $name\n"; __END__ <press enter key> Name is vaibhav $PROMPT>
Re^2: What is the output of perl command?
by Anonymous Monk on Jun 17, 2012 at 06:18 UTC
    :)
    $ echo print(666) | perl -l - | cat 666 $