in reply to •Re: Re^2: Tear it apart...select()
in thread Tear it apart...select()

I guess you can take a middle road with an explicit temporary with something like
select(do { my $oldfh = select(FH); $|++; $oldfh });
That's not too verbose and seems less obscure to me. The inevitable temporary is at least confined to a microscopic block.

Makeshifts last the longest.

Replies are listed 'Best First'.
•Re: Re^4: Tear it apart...select()
by merlyn (Sage) on Mar 02, 2003 at 16:01 UTC
    Well, that still makes it inside out, and also introduces a do block, which is not necessarily obvious.

    The obvious approach that reads nicely and keeps a confined temp var is:

    { my $old = select NEW; $|++; select $old }
    No fuss, no muss. Reads left to right. Says what it does.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Fair enough. I have a tendency to prefer a more functional style and to avoid actual naked blocks, but that's just my bias.

      Makeshifts last the longest.