in reply to how to remove empty pipe delimiters in a line which doesn't contain any data
use warnings; use strict; while (<DATA>) { s/[|]+/|/g; print; } __DATA__ IFB Northpole||| Alaska||| 907-555-5555 Walmart||| Fairbanks||| Alaska Chicken||| Anchorage||| Alaska||| 907-555-5555 Beef||| Somewhere|||||Over the Rainbow|||907-555-5555
Outputs:
IFB Northpole| Alaska| 907-555-5555 Walmart| Fairbanks| Alaska Chicken| Anchorage| Alaska| 907-555-5555 Beef| Somewhere|Over the Rainbow|907-555-5555
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to remove empty pipe delimiters in a line which doesn't contain any data
by rpinnam (Novice) on Oct 08, 2015 at 15:41 UTC | |
by Corion (Patriarch) on Oct 08, 2015 at 15:45 UTC |