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

(Partial answers to) Barstool Trivia

by dchetlin (Friar)
on Dec 16, 2000 at 02:09 UTC ( #46948=note: print w/ replies, xml ) Need Help??


in reply to Re: Barstool Trivia
in thread Barstool Trivia

Well, I warned you that it was an intentionally ambiguous question. My answers are from what the source considers different ways to start a scope, because I was playing around with that sort of stuff recently.

So, so far we've got three correct answers. `eval STRING', a block, and a loop. Remember that `do' and `require' are really special cases of `eval STRING'. And yes, the source does distinguish between a loop and a block.

There are four left which have yet to be named. I'll give you one more. This one is the last "easy" one, in that it's not completely surprising: `sub' starts a scope, and the source considers that different from a block.

So there are three more out there. These ones, especially two of them, are completely obscure ways to start scopes.

P.S. I too once knew the answer to the baseball question, but it's been too long. Base hit, walk, hit by pitch, dropped third strike, catcher's interference, fielder's choice, error. That's all I can think of, which is seven. My memory wants to say that a catcher's balk counts, but I think a catcher's balk has the same effect as a pitcher's balk. Hmm...

-dlc


Comment on (Partial answers to) Barstool Trivia
Re: (Partial answers to) Barstool Trivia
by tilly (Archbishop) on Dec 16, 2000 at 03:45 UTC
    Do you count the fact that a loop starts two scopes, not one?
    for (my $x = 0; $x < 10; ++$x) { # stuff my $y = $x; # more stuff }
    Note that $x and $y are in different scopes. $y is local to the body of the loop. $x is global to the loop.

    Also for some definition of scope, <package> starts a new scope.

    And if we want the source differing, an if starts a scope and is different from either a block or a loop - try to do redo and it ignores the enclosing if for the enclosing block or loop.

    I have also had occasion to run Perl code in a different process by opening a pipe to it, writing my code on the pipe, and then sending __END__. Does that count?

    What about running code using reval from Safe? Does that count as different from eval?

Re: (Partial answers to) Barstool Trivia
by Dominus (Parson) on Dec 16, 2000 at 04:38 UTC
    Says dchetlin:
    > ...catcher's balk...
    There's no such thing as a catcher's balk; you made it up. A balk is when the pitcher deceives the base runners by interrupting his pitching motion so that he can throw to one of the bases instead. The penalty is that the base runners are each awarded an extra base. But the batter never advances to first on a balk.

    The seven you listed is the same as what I came up with. a referred me to a web page that purported to list ten, but I decided that three of them were no good. (The best of the lot was that the batted ball might hit a runner, but I believe that's scored as a hit regardless.)

    I guess this has nothing to do with Perl. Maybe I'll get on the worst nodes list!

      I said:
      > There's no such thing as a catcher's balk; you made it up.
      Dan has graciously brought to my attention rule 4.03(a), "The catcher shall station himself directly back of the plate. He may leave his position at any time to catch a pitch or make a play except that when the batter is being given an intentional base on balls, the catcher must stand with both feet within the lines of the catcher's box until the ball leaves the pitcher's hand."

      And then follows the following annotation: "PENALTY: Balk."

      So there's a good case for my being wrong.

      Regardless, you still can't reach base on it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-04-18 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls