An alternative would be to use Text::CSV_XS, but I bet that won't be too fast either:
#!/pro/bin/perl use 5.20.2; use warnings; our $VERSION = "1.00"; use Text::CSV_XS qw( csv ); csv (in => *DATA, sep => "|", allow_whitespace => 1, quote_char => undef, escape_char => undef, on_in => sub { @{$_[1]} = grep m/\S/ => @{$_[1]} }); __END__ IFB Northpole||| Alaska||| 907-555-5555 Walmart||| Fairbanks||| Alaska Chicken||| Anchorage||| Alaska||| 907-555-5555 Beef||| Somewhere|||||Over the Rainbow|||907-555-5555
-->
IFB Northpole|Alaska|907-555-5555 Walmart|Fairbanks|Alaska Chicken|Anchorage|Alaska|907-555-5555 Beef|Somewhere|Over the Rainbow|907-555-5555
In reply to Re: how to remove empty pipe delimiters in a line which doesn't contain any data
by Tux
in thread how to remove empty pipe delimiters in a line which doesn't contain any data
by rpinnam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |