Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: perl puzzle - cartoon couple registry (TMTOWTDI)

by jynx (Priest)
on Jun 13, 2002 at 01:32 UTC ( #174092=note: print w/replies, xml ) Need Help??

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" );

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...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://174092]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2023-02-05 21:28 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.