The output from the -l0[pn] solutions includes C-@ characters (pipe through
cat -v to see...):
admins:^@ root, administrator
[EMAIL PROTECTED]:^@ me
^@
ugh!
A sub-optimal fix:
-p0 s/(.*):(.*)/$_{"$2:"}.=" $1,"/ge}for(%_){s/,$/
/
Greg
-----Original Message-----
From: Jose Alves de Castro [mailto:[EMAIL PROTECTED]
Sent: Monday, April 26, 2004 5:31 PM
To: [EMAIL PROTECTED]
Subject: Re: Break the 65 chars :-)
OK... Greg has just introduced me to some "Normal etiquette" (and also
to the "International" perl golf counting method)...
I apologize for not having submited my solution so far; the only reason
why I didn't do it was because I thought you might want to give it a try
without being influenced.
Here it goes:
#!/usr/bin/perl -l0n
/:/;$_{$'.$&}.=" $`,"}{map{s/,$/
/;print}%_
:-)
jac
On Mon, 2004-04-26 at 15:54, Jose Alves de Castro wrote:
> Try to do this in the least amount of characters possible :-)
>
> Sample Input:
>
> root:admins
> administrator:admins
> me:users
>
> Output:
>
> admins: root, administrator
> users: me
>
> My current solution is now on 65 bytes (that's the size of the whole
> script), but I guess more experienced golfers than me will probably
> manage to do something smaller... :-)
>
> Happy hacking ;-)
>
> jac
--
Jos� Alves de Castro <[EMAIL PROTECTED]>
Telbit - Tecnologias de Informa��o
------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated
recipient(s) named above. If you are not the intended recipient of this message you
are hereby notified that any review, dissemination, distribution or copying of this
message is strictly prohibited. This communication is for information purposes only
and should not be regarded as an offer to sell or as a solicitation of an offer to buy
any financial product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or
error-free. Therefore, we do not represent that this information is complete or
accurate and it should not be relied upon as such. All information is subject to
change without notice.