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

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
My answers without looking at existing ones...
  1. 1: I've seen this in chatter mentioned by tye, but the trick slips my memory at the moment. :-(
  2. 2: {foo;redo} # See RE: My favorite looping mechanism in Perl is:
  3. 3: This is actually two questions
    • My first thought was pseudohashes but pseudohashes are deprecated and IIRC removed in 5.8.0. Then it was $foo = \*bar; $$foo->[1] = $$foo->{1} = "hello" Hrm, Pseudohashes are allowed? OK then, $x = [{1=>1}, "hi"]; Your test will pass, albeit with an ugly scalar for each, but they are not accidentally the same, they are both references to the same string.
    • Trivial with overload, but I am not sure if that is breaking your rules. OK, sub bar {$bar[$_[0]]} $foo = \*bar; $bar[1]="hi";, that isn't a different idea than what I originally did for 3a, but it works. UPDATE 3 I don't know how to do this after all.
  4. 4: dump # So sorry, did you want solutions that aren't supposed to core dump? :-P
  5. 5: my $static if 0; # See Tie::Static for my opinion on this...
  6. 6: Is it cheating for me to use a module but not write one?
    # Reformat to one line if you want -e use overload qq("")=>sub{"same"}; $x = bless \$foo; $y = bless \$bar; $$x= "x"; $$y= "x";
    UPDATE You do this like so: $x = do {local *foo}; $y = *foo; $foo = "hello";
  7. 7: UPDATE 2 $foo = *STDOUT{IO};
  8. 8: *x = \$|
  9. 9: This is actually two questions UPDATE Um, in the questions shouldn't q be qq everywhere? If you don't let $$foo interpolate, it shouldn't matter what is in it...
    • UPDATE 3 $foo = \$!; $!=1; UPDATE 5 Oops, this is wrong. I should test these answers a little, ya think?
    • 9b
  10. 10
  11. 11: UPDATE 4 Put sub CORE'GLOBAL'glob{""} at the END of your code. Location matters, this code has to be seen by the Perl interpreter after Perl has seen some evidence that it needs to load File::Glob (which will overwrite us).
Bonus
I, um, would have gotten more if I didn't have to go to work. Yeah, that's the ticket...

UPDATE Minor fixes. BTW I should add that while I am not terribly bad at this kind of trivia, I think that focussing on it is a horrible mistake.

UPDATE 2 Answered 7.

UPDATE 3 Took time out for 9a. I had been thinking about 10, but because nobody else bothers to hide their answers, I saw mtye's version already. 3b has me puzzled again (see Roy Johnson's note).

UPDATE 4 Added a solution to problem 11.

UPDATE 5 Admit my mistake in problem 9a. I think that I'll admit to not knowing stupid Perl trivia that well these days. Particularly since nobody else seems to be trying these too hard. Also note that my solution to problem 11 can't be placed in front with glob-assign without adding a semi-colon, which puts you over the character limit.


In reply to Re: How's your Perl? by tilly
in thread How's your Perl? by xmath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (6)
    As of 2018-07-17 06:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















      Results (355 votes). Check out past polls.

      Notices?