[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] joining columns in csv files



On Wed, Nov 15, 2000 at 04:19:56PM -0800, Larry Rosler wrote:
> > From: yanick1@sympatico.ca [mailto:yanick1@sympatico.ca]
> >
> > perl -pe's/,/$&if++$i,!grep$i==$_,4,5,6/eg'
> >
> > get a lower golf score and is correct (as far as I know). Yay! :)
> 
>   perl -pe's/,/3<++$i&&$i<7?"":$&/eg'
> 

	Well, yeah. But 

		perl -pe's/,/$&if 4>++$i||$i>6/eg'
	
	is still one stroke shorter, and

		perl -pe's/,/$&if 1<abs++$i-5/eg' 

	is still better. :) Although I prefer my first solution, as
it's more general. 

Joy,
Yanick

-- 
print map { ( split '', 'P arctehYkl.no' )[ hex ] } 
      split '', '86512cd57631063a1724963b';

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe