in reply to pipe delimited file problem
use strict; use warnings; my $litPipe = q{\|}; my $rxBetween = qr {(?x) (?: (?<=\A) | (?<=$litPipe) ) (?=$litPipe|\n) }; while (<DATA>) { s{$rxBetween}{EMPTY}g; print; } __END__ a|b|c|d|e f||h|i|j |l|m|n|o ||||t u|v|w|x|
Here's the output
a|b|c|d|e f|EMPTY|h|i|j EMPTY|l|m|n|o EMPTY|EMPTY|EMPTY|EMPTY|t u|v|w|x|EMPTY
Because the regular expression pins down exactly where you want to do the substitution it copes well with beginning and end of line situations.
I hope this is of use.
Cheers,
JohnGG
|
|---|