cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:
I want to read this into a hash. How do I do it with map?key1 = value1 key2 = value2
I'm sure with a little help, and if I keep bashing my head against the wall using map for these kinds of situations will finally sink in.open( INF, 'file' ); %hash = map { my ( $a, $b) = split( / = /, chomp($_) ); $a => $b } + <INF>;; close( INF );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Probably an easy map question
by shmem (Chancellor) on Jan 15, 2009 at 02:01 UTC | |
by andye (Curate) on Jan 15, 2009 at 17:02 UTC | |
by shmem (Chancellor) on Jan 15, 2009 at 18:48 UTC | |
|
Re: Probably an easy map question
by kyle (Abbot) on Jan 15, 2009 at 02:21 UTC | |
by pobocks (Chaplain) on Jan 15, 2009 at 04:49 UTC | |
by kyle (Abbot) on Jan 15, 2009 at 04:53 UTC | |
by pobocks (Chaplain) on Jan 15, 2009 at 04:57 UTC | |
|
Re: Probably an easy map question
by Lawliet (Curate) on Jan 15, 2009 at 02:10 UTC | |
|
Re: Probably an easy map question
by jdporter (Paladin) on Jan 15, 2009 at 02:52 UTC | |
by ikegami (Patriarch) on Jan 15, 2009 at 08:56 UTC | |
|
Re: Probably an easy map question
by bcrowell2 (Friar) on Jan 15, 2009 at 02:19 UTC | |
|
Re: Probably an easy map question
by JavaFan (Canon) on Jan 15, 2009 at 11:01 UTC | |
by jdporter (Paladin) on Jan 15, 2009 at 18:01 UTC |