$col->[26] = $col->[26] eq '0" ? '' : $col->[26]; # note the extra -> in there that was missing from your code. # or, more succinctly: $col->[26] = '' if $col->[26] eq '0'; # or, probably better yet: $col->[26] ||= '';