Metasyntactic variables. We all use 'em. We all love 'em. What would our examples be, without the ubiquitous foo, bar, and even baz? Could we possibly go on coding sanely if we couldn't throw our inside jokes into code that our suit-y bosses will never see?

This, my bretheren and sisteren, is my Tribute to the Metasyntactic Variable. D/L the code, save it to a file (preferably foo.pl), run it, and it randomly spits out a little metasyntactic treat!

Enjoy,
higle

Update: "prettied" up the FOO
#!/usr/bin/perl -w use strict; for($[..(eval($[-$[**$[+1))){$\=$/;my$bar; while(<DATA>){chomp;s;[\s]+;;g;$bar.=$_;} my@baz=split(/\\\|/,$bar);my@foo=map{chr if defined $_}(split(/\\/,$baz[rand@baz])); my$foo;foreach(@foo){$foo.=$_;} $_=$foo;print;}__DATA__ 102\111\111\|98\97\114\ |98\97\12 2\|98\97\ 114\102\|109\117\109\98\ 108\101\|113\117 \120\|113\117\11 7\120\|113\117\117\117\120\|98\97\12 2\111\1 08\97\ |122\11 6\101\115\99\104\|116\104\117\100\|1 03\114\ 117\11 0\116\ |98\108\101\116\99\104\|102\117\109\ |106\10 5\109\ |115\10 4\101\105\108\97\|98\97\114\110\101\ 121\|10 2\114\ 101\100 \|99\111\114\103\101\|103\114\97\117 \108\11 6\|102 \108\97 \114\112\|102\108\97\114\98\|122\120 \99\|11 5\112\ 113\114 \|119\111\109\98\97\116\ |115\1 04\109\ 101\|9 8\111\1 10\103\111\|115\112\97\ 109\|1 01\103\ 103\11 5\|115\ 110\111\114\107\|122\11 1\116\ |98\108 \97\11 4\103\| 119\105\98\98\108\101\| 119\11 1\111\1 16\|11 6\111\1 16\111\|116\105\116\105 \|116\ 97\116\ 97\|11 6\117\1 16\117\|112\105\112\112 \111\| 112\108 \117\1 16\111\ |112\97\112\101\114\105 \110\1 11\|97\ 97\112 \|110\1 11\111\116\|109\105\101 \115\| 111\111 \103\1 08\101\ |102\111\111\103\108\10 1\|98\ 111\111 \103\1 08\101\ |122\111\114\107\|98\11 1\114\107\|103\ 111\114\107\|10 2\111\111\98\97\114\|10 2\111\111 \98\97\122

In reply to Tribute to Metasyntactic Variables by higle

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, details, 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, summary, 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.