in reply to regex not working properly
$row =~ s#\s+$##; looks to be the problem. the $ means it will only match at the end of the string. if you want to remove all spaces:
(code is untested)$row =~ s/\s+//g; # Remove only spaces in other wise empty records $row =~ s/\|\s+\|/||/g; # Same but add a zero even for empty items $row =~ s/\|\s*\|/|0|/g;
They say that time changes things, but you actually have to change them yourself.
Andy Warhol
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: regex not working properly
by Anonymous Monk on Mar 05, 2007 at 22:43 UTC | |
by graff (Chancellor) on Mar 06, 2007 at 02:25 UTC |
In Section
Seekers of Perl Wisdom