Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: How to Map a scalar to a key that is an array?

by Laurent_R (Canon)
on Aug 01, 2019 at 21:15 UTC ( #11103738=note: print w/replies, xml ) Need Help??


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"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11103738]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (1)
As of 2021-10-17 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (72 votes). Check out past polls.

    Notices?