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


in reply to perl puzzle - cartoon couple registry (beginner, semi-golf)


Since i can't think of a good way to golf this well, i'll bend the rules slightly. Here's a solution that you place before the couples declaration. It uses command line options, two quotes, and weighs in at 58 chars. Slightly amusing...
#!/usr/bin/perl -l #23456789_123456789_123456789_123456789_123456789_123456789_ sub _{print shift()." is married to ".shift while@_}_ sort %couples = ( Fred=>"Wilma", Barney=>"Betty", George=>"Jane", Homer=>"Marge", Peter=>"Lois" );
jynx

Update: Ah, err, uh, whoops... LOL! This is a non-working solution. It's really amusing who's married to whom in it though! Sorry about that, apparently my eyesight is going (i thought it looked fine until i retested a couple minutes ago) -- it must be time to go home...