Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 cooling their heels in the Monastery: (6)
As of 2023-03-27 00:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (63 votes). Check out past polls.

    Notices?