Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: pipe perl

by VinsWorldcom (Vicar)
on Oct 30, 2012 at 18:58 UTC ( #1001538=note: print w/ replies, xml ) Need Help??

in reply to pipe perl

See open. Then try this:

open(my $old, '|-', "/bin/old"); select((select($old), $| = 1)[0]); foreach my $INPUT(@DATA) { my ($LAST_NAME,$FIRSTNAME,$ID_NUM,$BOOK) = split(/\s+/,$INPUT); print $old "$LAST_NAME\t$FIRSTNAME\n"; print $old "\t$ID_NUM\t$BOOK\n" }

Comment on Re: pipe perl
Download Code
Replies are listed 'Best First'.
Re^2: pipe perl
by kennethk (Abbot) on Oct 30, 2012 at 20:21 UTC
    A very important element for this solution (which goes unmentioned above) $| = 1. This turns off buffering on the output stream, or "sets the pipe to hot" (see perlvar). If you are having buffering issues, you can also close your file handle to clear the buffer.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001538]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2015-11-28 18:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls