undef takes a scalar, not a list. (see perldoc -f undef)
use strict; use warnings; my %hash = ( foo => 'bar' ); my @index = qw( baz bong ); my @a2 = qw( a b c ); undef %hash, @index, @a2; print %hash, @index, @a2; __END__ # prints -> baz bong a b c
When I do this with warnings on, though, I get "Useless use of private array in void context" warnings, since the remainder of that expression does nothing with the variables. You should be seeing those too, no?
Rather than depending on yourself to clear out values at the top of each loop, I strongly recommend just making them lexicals, and use strict. You avoid this whole class of bugs.
Additionally, I am not sure what %hash and @index are doing in there. You populate them, then don't use them, then clear them.
In reply to Re: Why output is appending in each file??
by fishbot_v2
in thread What is the problem with this script as no output
by cybersmithuk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |