while (1) { open(FIFO, ">$ENV{HOME}/.plan") or die "Couldn't open $ENV{HOME}/.plan for writing:$!\n"; print FIFO "The current time is", scalar(localtime), "\n"; close FIFO; sleep 1; }
What this code does is write the time to a file called ".plan" in your home directory. It does this every second and will overwrite the previous file. It will end only when the script cannot open the file for writing. Or, just like any other Unix process (and I know it's Unix cause of the usage of $ENV), it can be kill'ed from the commandline.

Now, this isn't an example of FIFO or piping or anything of the sort. It's just a plain old write-to-file script. The 'pipe command' you refer to is probably a commandline thing in Unix.

Or, alternately, it could refer to opening a datastream which is the result of a command, along the lines of open(LS_PIPE, "ls -F|"); That allows you to read from LS_PIPE the results of 'ls -F', as if it was any other file or socket.

------
/me wants to be the brightest bulb in the chandelier!

Vote paco for President!


In reply to Re: Understanding Code by dragonchild
in thread Understanding Code which uses pipe to bulk copy data by dreman

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.