in reply to Re^2: How to clean an array of strings after a split
in thread How to clean an array of strings after a split
Actually, if you used kcott's suggestion here and split into a named array, e.g.
my @fields = map { ... } split ..., $str;
you wouldn't have to worry about how many pipes there are and 'uninitialized' variables: you get what you get, it's all defined, and it's easy to test how much you've gotten by taking the size of the array and to iterate over the array. Rather than writing $varn you write $fields[n] instead, but 0-based.
But I assume you have your reasons for preferring individual named variables...
|
|---|