in reply to Extracting data from a pipe delimited text file
There are dozens of ways I imagine. I'd probably choose a lookahead: $line =~ s/\s+(?=\|)//g. Hrm, I just noticed there's space after one of them. A look-ahead is probably the wrong choice then. I'd probably choose $line =~ s/\s*\|\s*/\|/g instead — there may be a more efficient way though.
I won't guarantee it's use in a production environment though. I've never tested the above.
-Paul
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting data from a pipe delimited text file
by Ionitor (Scribe) on Mar 29, 2007 at 19:13 UTC |