Please tidy up that response, it is badly formatted.

$ ( echo Hi; sleep 3; echo Bye ) | ./ReadAPipe.pl a b c
This was read from the pipe:
<Hi
Bye>

This was the read from the parameters:



./ReadAPipe.pl a b c
This was read from the pipe:
<>

This was the read from the parameters:

Saving your (cleaned up) ReadPipe.pm to a sensible location and running your ReadAPipe.pl, I get:

qwurx [shmem] ~> ( echo Hi; sleep 3; echo Bye ) | ./ReadAPipe.pl a b c This was read from the pipe: <Hi Bye> This was the read from the parameters: <a b c> qwurx [shmem] ~> ./ReadAPipe.pl a b c This was read from the pipe: <> This was the read from the parameters: <a b c>

I suspect that the code / result you posted isn't consistent (version mismatch?)

Please note that the value returned requireing your ReadPipe.pm (which is invoked by use) is the number of elements contained in @EXPORT_OK - which might, or might not, be intended. You should be aware of this side-effect. If your module read

... our @EXPORT_OK = qw( ReadPipe ); my $foo; ...

then loading the module would fail, since the value computed from my $foo is undefined.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

In reply to Re^2: Need pipe and parameter help by shmem
in thread Need pipe and parameter help by Todd Chester

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.