Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: another 'array to hash' question

by davido (Cardinal)
on Dec 10, 2003 at 17:17 UTC ( [id://313776]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # I have
    my ($fn, $ln, $age) = qw(Joe McCarty 89);
    
    # I want
    my %crazyperson = ( 'fn' => 'Joe', 'ln' => 'McCarty', 'age => 89);
    
  2. or download this
    my %crazyperson;
    @crazyperson{'fn', 'Joe', 'ln'} = qw/Joe McCarty 89/;
    
  3. or download this
    $name = "Ted";
    while ( my $line = <DATA> ) {
    ...
    name,Frank
    __OUTPUT__
    Frank
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-19 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found