Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 ( [id://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?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-25 05:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found