$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
In reply to Re: regex not working properly
by JediWizard
in thread regex not working properly
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |