http://www.perlmonks.org?node_id=1068855


in reply to 2014 Code Golf Challenge


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: 2014 Code Golf Challenge
by tobyink (Canon) on Jan 01, 2014 at 13:58 UTC

    I've not been able to make that work in any character set supported by any of my text editors, but I believe I understand the principle. "" seems to work in ISO-8859-1 and ISO-8859-15.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
      I've not been able to make that work in any character set supported by any of my text editors

      My console defaults to code page 850 (see the pic.)

      What I did was print:
      [0] Perl> print ~'2014';;
      ═╬╦

      And then c&p the output back inside the string:
      [0] Perl> print ~'═╬╦';;
      2014

      Presumably if you do the same thing on your local console you should be able to get the same effect although the displayed glyphs will be different. (Though I guess it won't work for Unicrap consoles :)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        According to the StackExchange golfing rule book, you're allowed to assume perl is being run as perl -M5.010, so can use say. This takes the solution down to 10 bytes, beating even many of the esolangs, while still being pretty obvious how it works.

        use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
        That's pretty much optimal, since Perl bitches about putting those things directly in your source, so you can't get rid of the quotes. What are you using as a REPL here?