Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: why use a hash instead of an array

by karlgoethebier (Vicar)
on Jun 11, 2013 at 19:20 UTC ( #1038331=note: print w/ replies, xml ) Need Help??


in reply to why use a hash instead of an array

It's just about how you want/like/need your data:

#!/usr/bin/env perl + use strict; use warnings; use Data::Dumper; my $karl; $karl->{nose} = qq(cuke); $karl->{monk} = 1; $karl->{axes} = ["Strat", "Ibanez"]; $karl->{pets} = ["Dog", "Fishes"]; $karl->{skills} = ["C", "Perl", "Ecma", "NULL"]; print Dumper($karl); __END__ Karls-Mac-mini:monks karl$ ./karl.pl + $VAR1 = { + 'skills' => [ + 'C', + 'Perl', + 'Ecma', + 'NULL' + ], + 'pets' => [ + 'Dog', + 'Fishes' + ], + 'nose' => 'cuke', + 'monk' => 1, + 'axes' => [ + 'Strat', + 'Ibanez' + ] + };

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»


Comment on Re: why use a hash instead of an array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2015-07-28 08:46 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 (254 votes), past polls