Instead of listing the individuals values you could use a hash slice:
Something like: @fields{qw/partner kampagne keywordCluster keyword ..../}
And maybe it would be better to use another construct then 'map'... 'for' can be useful, since it alias the element which would mean you need to write $fields{partner} only once instead of twice (when setting the default value).
Something like:
for (@fields{qw/partner kampagne .../}) { $_ = "", unless (defined $_) +; }
Updated, added second code-example
Update2: instead of listing each element in the for you could also use values %fields. This will ensure that there are no undefS in the hash
In reply to Re: Text::xSV question - could this be written better?
by Animator
in thread Text::xSV question - could this be written better?
by tphyahoo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |