Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: more fun w/ HASh ref's

by jarich (Curate)
on Dec 12, 2005 at 02:48 UTC ( #515942=note: print w/ replies, xml ) Need Help??


in reply to Re^2: more fun w/ HASh ref's
in thread more fun w/ HASh ref's

Consider the following code snippet:

my %options; my $options->{'heredoc'} = '1'; my $config_copy = ReadINI ($copy,%options);

What this is actually saying is annotated below.

# Create a hash called %options my %options; # Create a *scalar* variable called $options and then try # to use it as a reference. Since it's just been created, # it's undefined. Hence this won't work. my $options->{'heredoc'} = '1'; # Call ReadINI passing it $copy and your %options hash. my $config_copy = ReadINI ($copy,%options);

I imagine that the line you want to have in the middle there is:

$options{heredoc} = 1;

It's a hash look up. %options is a hash, not a hash reference. If its not a reference, you don't want the arrow.

I hope this helps.

jarich


Comment on Re^3: more fun w/ HASh ref's
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (18)
As of 2015-07-01 15:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (6 votes), past polls