Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: How to create hash out of an array elements?

by ikegami (Pope)
on Nov 17, 2011 at 10:02 UTC ( #938572=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to create hash out of an array elements?
in thread How to create hash out of an array elements?

Then $symbolsizes[0] doesn't contains function. Perhaps it contains a trailing newline that you didn't remove using chomp?


Comment on Re^3: How to create hash out of an array elements?
Select or Download Code
Replies are listed 'Best First'.
Re^4: How to create hash out of an array elements?
by aaron_baugher (Curate) on Nov 17, 2011 at 12:24 UTC

    And to see exactly what your hash does contain, use Data::Dumper (or one of its descendants). (I'm passing Dumper a reference to the hash because it prints it in a more hash-like manner that way.)

    abaugher@Aliantha ~$ cat doit #!/usr/bin/perl use Modern::Perl; my @array = ( 'key', 'value' ); my %hash = @array; say "The value of 'key' is '$hash{key}'"; use Data::Dumper; print Dumper \%hash; abaugher@Aliantha ~$ perl doit The value of 'key' is 'value' $VAR1 = { 'key' => 'value' };

    Aaron B.
    My Woefully Neglected Blog, where I occasionally mention Perl.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2015-07-08 01:04 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 (93 votes), past polls