Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

•Re: Tear it

by merlyn (Sage)
on Mar 02, 2003 at 04:07 UTC ( #239820=note: print w/replies, xml ) Need Help??

in reply to Tear it

As the originator of that meme, let me apologize for that, right alongside my apology for originally promoting the use of grep in a void context purely for its side effects, and for originating the concept of a JAPH, which tends to lead non-Perl hackers to believe that Perl is only about obscurity.

I'm sorry.

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

Replies are listed 'Best First'.
Re^2: Tear it
by Aristotle (Chancellor) on Mar 02, 2003 at 13:38 UTC
    I understand the apologies for grepping in void and the concept of the JAPH, but why do you apologize for the select idiom?

    Makeshifts last the longest.

      Well, the post was all tongue in cheek, but to break character here, the select() idiom was something I came up with one day when I was trying to unbuffer an arbitrary filehandle, regardless of the currently selected filehandle. Since I had invented the literal slice notation, I wondered if that could be used there to eliminate the normal temporary variable by holding the previous handle as part of the constructed list. And boom, there it was.

      The problem is that its obscurity offsets any useful gain over just writing it as a normal two or three step process.

      Another way to do it without using a "temporary" variable might be something like:

      for (select(HANDLETOUNBUFFER)) { $|++; select($_); }
      But I'd argue this is just as obscure.

      Moral of the story: it's ok to say my $old = select(NEW); when you need the old handle. It's fine. Don't worry. Be happy.

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

        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.

Re: Re: Tear it
by snafu (Chaplain) on Mar 02, 2003 at 05:50 UTC
    But that is one of the coolest things about Perl!!! =P It keeps me on my toes!

    _ _ _ _ _ _ _ _ _ _
    - Jim
    Insert clever comment here...

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2022-06-27 04:49 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (86 votes). Check out past polls.