[OT] golf

Abigail abigail at abigail.be
Tue Mar 4 22:03:59 GMT 2008


On Tue, Mar 04, 2008 at 04:46:03PM -0500, Uri Guttman wrote:
> >>>>> "A" == Abigail  <abigail at abigail.be> writes:
> 
>   A> On Tue, Mar 04, 2008 at 06:53:00PM +0000, Nicholas Clark wrote:
>   >> 
>   >> perl -0777lp015e0
> 
>   A> I've used a similar trick to replace characters. For instance,
>   A> to replace \r with \n, one could do:
> 
>   A>     perl -015pl12e1
> 
> i think nick's code has a bug or extra opts. the 015 needs to follow the
> -l option as abigail does with 12. in his it follows the -p which takes
> no argument. maybe perl will use 015 for the record separator arg and
> override the -0777 (which slurps the whole file in). i don't see how
> slurping and also setting -l and -015 would work. of course i didn't run
> it as that would take the fun out of analyzing it. :)


No, Nick's code is correct. It's short for

   perl -0777 -l -p -015 -e 0


The first -0 sets $\, the second sets $/.



Abigail


More information about the london.pm mailing list