Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How to change an Array to a Hash

by vinoth.ree (Monsignor)
on Aug 01, 2018 at 06:01 UTC ( #1219620=note: print w/replies, xml ) Need Help??


in reply to How to change an Array to a Hash

The easiest way to convert array to hash,

use strict; use warnings; use Data::Dumper; my @list= ("Andy", "1995", "Sarah", "1990", "Sam", "1992"); my %people = @list; print Dumper \%people;
Output:
$VAR1 = {
          'Andy' => '1995',
          'Sarah' => '1990',
          'Sam' => '1992'
        };


All is well. I learn by answering your questions...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2020-09-19 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (114 votes). Check out past polls.

    Notices?