in reply to How's your Perl?

There's a bunch of spoilers here so click readmore to read them.
  • 1. I knew it was a trick using @_'s aliasing but I didn't pick up the glob assignment until I saw what BrowserUK did.
  • 2. {foo;redo}
  • 3a. $foo=*foo;$foo->[1]=$foo->{1}=\undef
  • 3b. I started fiddling with $foo=[(\!1)x2];*{"$foo"}=sub{!aye}' but was stopped by perl complaining that $foo was an array reference. I just wanted it to call the function with the name of its strinfied reference but I didn't see an immediate way around it.
  • 4. dump
  • 5. sub foo { my $x if 0 }
  • 6. $x = \1; $y = "$x"; $$y = 2
  • 7. $foo=*STDOUT{IO}
  • 8. I'm not sure how to read this. It is invalid to assume that either post increment would occur before each other - this is one of the cases where "undefined execution order" really comes into play. Now obviously, the actual order is defined by the optree which is defined by the implementation in which the first post increment (lexically) is going to execute first. So in which light am I supposed to solve this? The fiddly bits of the implementation (which in this case I'm not sure anyone is supposed to expect anything in particular) or the implementation's promise which is unspecified?
    Update 1*foo=$|;$foo=1 This answer assumes things about perl that I'm damned if I'll admit that this is a fair question. This particular behaviour is officially undefined (as to much of the rest of perl which is undefined by ommision).
  • 9a. $0=1;$foo=0
  • 9b. I'm stumped.
  • 10. I didn't see how to do this in twenty-six characters but here's a forty-five character solution: $"=::;${"@{[map 56922&2**$_?'y':x,0..15]}"}=1. I went on to start playing with ORing the bittests into the string value 'x' and got bored. print "@{[map(q[x]|q[].!(56922&2**$_),0..15)]}"
  • 11. I got tired and while I'm still probably stumped, I don't have the initiative anymore.