=pod =for advent_year 2010 =for advent_day 19++ =for advent_title So, umm, I told Santa what I wanted and he was totally, like, whatever… =cut OR Murry Currystmas =pod =for advent_author Adam Russell & Jerrad Pierce The elves in Santa's shop are a fun-loving but superstitious folk, and pranced about with glee when they discovered that today's entry aligned with A. M allows us to use some of Perl 6's "whatever-star" magic in P5. What does this give us? How does it work? C to access "whatever-terms" C<&*>,C<$*>N, C<&@> , and C<&_>; as punctuation variables these are magically global. All four behave in the same way: you get back a coderef which will later perform the actions defined by the statement they are used in when a value is passed for it to act upon. In computer sciencey words you could say that the whole expression is returned as a closure, resulting in a curriedN function. The differences between the four spellings of whatever alter what it stands in for:
  • C<&*> and C<$*> favor C<$_[0]> over C<$_> if available
  • C<&@> always uses C<$_[0]>
  • C<&_> always takes $_
Let's delight the easily-amusedN with some small tricks… =sourcedcode mod19.pl =cut =begin footnote note0 Prior to its deprecation in 5.10, C<$*> enabled multi-line matching. =end footnote =begin footnote note1 A. =end footnote =begin footnote note2 You try not to be amused by the littlest thing after spending 12 hours gluing heads on nutcrackers. =end footnote