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


in reply to Re^4: Golf: Seven segment display
in thread Golf: Seven segment display

I'd say the use of $' is less than obvious. Nice work btw.

The shortest solution I know (not my own creation):

for$;(0..2){say map{substr' | |_|_ _ _|',vec('0123456789abcdef',$;.$ +_,4),3}"@_"=~/./g}

where '0123456789abcdef' is to be substituted with "\x09\x99\x90\x99\x99\x13\xBB\x75\x17\x55\x15\xB7\xB1\x15\xB5". When the \x codes are replaced with the actual characters, it comes out two characters shorter than the solution above. (Not very elegant, though.)

Replies are listed 'Best First'.
Re^6: Golf: Seven segment display
by mtve (Deacon) on Jan 29, 2012 at 10:59 UTC

    Cool!

    Could be shortened by two chars using the same tricks:

    say map{substr'   | |_|_ _ _|',vec('0123456789abcdef',$'.$_,4),3}split!//,"@_"for 0..2