[ABE.pm] perl regex Q

Jim Eshleman jce0 at Lehigh.EDU
Tue Dec 14 19:33:21 CST 2004


>>This:
>>
>>perl -ne 'chomp;print join(",",map {$_ or "\\N"} split ",",$_,-1), "\n"'
>>
>>should work and handle the corner cases of leading and/or trailing 
>>commas.  Likely not as fast as a regex but *maybe* easier to understand.
> 
>  
> I think you mean: 
> perl -ne 'chomp;print join(",",map {defined $_ ? $_ : "\\N"} split ",",$_,-1), "\n"'
> 
> Otherwise, a 0 will become a \N    :)

   Heh heh.  Oops.  Well, a zero will always be input as 0.0, right? ;)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.pm.org/archives/abe-pm/attachments/20041214/aa307f94/signature.bin


More information about the ABE-pm mailing list