in reply to deletion in hash of array

Use <code> and </code> to quote your code.

Add use Data::Dumper; to the top of your code, and then add print Dumper(\%hash); before your while loop to investigate what's actually in your hash.

In my example below, everything worked fine.
use Data::Dumper; $hash{a} = [ 1, 2, 3 ]; $hash{b} = [ 4, 5, 6 ]; print Dumper(\%hash); while (($key, $value) = each %hash) { print $key, "\n"; delete $hash{$key}; }
Output -
$VAR1 = { 'a' => [ 1, 2, 3 ], 'b' => [ 4, 5, 6 ] }; a b
By the way, what was the syntax error it complained about?