Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: confused (and frustrated) about stdin/out

by kwoff (Friar)
on Dec 03, 2001 at 03:51 UTC ( #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.
  • Comment on Re: confused (and frustrated) about stdin/out

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?

      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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-12-01 06:40 GMT
Find Nodes?
    Voting Booth?