Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: perl puzzle - cartoon couple registry (beginner, semi-golf)

by Cybercosis (Monk)
on Jun 12, 2002 at 08:05 UTC ( #173743=note: print w/replies, xml ) Need Help??


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

well, here's something that qualifies (it's only a slight improvement over previous answers for better rules-conformity.
weighing in at 67 chars:

print"$_ is married to $couples{$_}",chr 0x0a for sort keys%couples

just tr/0x0a/0x0d/ if your system uses that for newline. and, at 76 chars (ever so short of the limit...), the same code with microsoft newline:

print"$_ is married to $couples{$_}",chr 0x0d, chr 0x0a for sort keys%couples

~Cybercosis

Replies are listed 'Best First'.
Re: Re: perl puzzle - cartoon couple registry (beginner, semi-golf)
by Util (Priest) on Jun 12, 2002 at 20:00 UTC

    Unless you have done binmode STDOUT, you can print "\n" and it will print the appropriate newline for your system, including those with a two character newline (CP/M and DOS use "\x0D\x0A").

    Also, why use chr 0x0a instead of the shorter chr 10?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2022-12-05 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?