You might try something like this:
...roboticus#!/usr/bin/perl -w use strict; use warnings; my $in = <DATA>; my @fields = # Remove leading & trailing space from each list element map { s/^\s+//; s/\s+$//; $_ } # Split input string into fields at '|' split /\|/, $in; print join('|',@fields), "\n"; __DATA__ abcd |abcd|abcd | abcd | abcd|
In reply to Re: Extracting data from a pipe delimited text file
by roboticus
in thread Extracting data from a pipe delimited text file
by mantra2006
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |