Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: confused (and frustrated) about stdin/out

by kwoff (Friar)
on Dec 03, 2001 at 03:51 UTC ( [id://129014]=note: print w/replies, xml ) Need Help??


in reply to confused (and frustrated) about stdin/out

open2() is from the module IPC::Open2.
From `perldoc IPC::Open2`:
This whole affair is quite dangerous, as you may block forever. It assumes it's going to talk to something like bc, both writing to it and reading from it. This is pre­sumably safe because you "know" that commands like bc will read a line at a time and output a line at a time. Pro­grams like sort that read their entire input stream first, however, are quite apt to cause deadlock.

Replies are listed 'Best First'.
Re: Re: confused (and frustrated) about stdin/out
by smackdab (Pilgrim) on Dec 03, 2001 at 05:19 UTC
    We'll that's embarassing ;)

    Know of a command or module that would allow me to emulate the way sort works?

    -thanks
      You mean besides sort?
      # With each line in @unsorted @sorted = sort @unsorted; # With all lines in $unsorted, maybe use IO::String my $S = new IO::String \$unsorted; @sorted = sort <$S>; # Or just split on newlines, maybe reversed too: @sorted = reverse sort split $/, $unsorted;
      Consider File::Sort for anything more complex.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found