http://qs321.pair.com?node_id=11103738


in reply to Re^3: How to Map a scalar to a key that is an array?
in thread How to Map a scalar to a key that is an array?

#use strict; #use warnings;
Why do you comment out these two lines? It is usually a very bad idea.

Otherwise, the more idiomatic way to write your foreach loop would be to declare $key within the loop:

foreach my $key (keys %data) { print "$key,$data{$key}\n"; }