[ABE.pm] perl regex Q

Ricardo SIGNES rjbs-perl-abe at lists.manxome.org
Tue Dec 14 19:15:09 CST 2004


* Jim Eshleman <jce0 at lehigh.edu> [2004-12-14T20:08:44]
> 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    :)

-- 
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/archives/abe-pm/attachments/20041214/18e8c2b8/attachment.bin


More information about the ABE-pm mailing list