Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread Chris Wagner
Oh so it was working all along. U were just "testing" it wrong. ;) At 09:48 PM 7/16/2006 -0500, Michael D. Smith wrote: >The array was loaded from a file. All the keys (and data) had newlines on >the end. When I asked for a key without a newline -- it wasn't there -- and >I just assumed the sta

RE: How to: load array into Hash

2006-07-16 Thread Eric Edwards
$Bill wrote: Note the line above with ^^ under it. Isn't that setting %hash to @array ? > my %hash = @array; The code snippet was hardly sufficient if it doesn't compile or produce any output. Show me a complete code snippet that fails. Eric Edwards wrote: $B

Re: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
At 09:45 PM 7/16/2006, you wrote: >Eric Edwards wrote: > > > $Bill wrote: > > When you post code, post a small complete failing snippet with any input > > and output examples: > > use strict; > > use warnings; > > use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1; > > my @array

Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread $Bill Luebkert
Michael D. Smith wrote: > Thanks again everyone. Data::Dumper was the "key" to the whole thing. > > The array was loaded from a file. All the keys (and data) had newlines on > the end. When I asked for a key without a newline -- it wasn't there -- and > I just assumed the statement was a little

Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
Thanks again everyone. Data::Dumper was the "key" to the whole thing. The array was loaded from a file. All the keys (and data) had newlines on the end. When I asked for a key without a newline -- it wasn't there -- and I just assumed the statement was a little to cute -- but not for PERL :) m

Re: How to: load array into Hash

2006-07-16 Thread $Bill Luebkert
Eric Edwards wrote: > $Bill wrote: > When you post code, post a small complete failing snippet with any input > and output examples: > use strict; > use warnings; > use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1; > my @array = (Key1 => 'Value1', Key2 => 'Value2', Key3 => 'Val

Re: [SPAM] RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
At 08:03 PM 7/16/2006, Charles K. Clarkson wrote: >Michael D. Smith wrote: > >: This is what I want to do: >: >: %hash = @array; >: >: But it don't work :) > >Define "it don't work". There is nothing in the hash after execution. It's defined, but empty. I printed the array, it's there, ju

RE: How to: load array into Hash

2006-07-16 Thread Eric Edwards
$Bill wrote: When you post code, post a small complete failing snippet with any input and output examples: use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent=1; $Data::Dumper::Sortkeys=1; my @array = (Key1 => 'Value1', Key2 => 'Value2', Key3 => 'Value3', Key4 => 'Value4'); my %hash

RE: How to: load array into Hash

2006-07-16 Thread Chris Wagner
At 07:25 PM 7/16/2006 -0500, Michael D. Smith wrote: >This is what I want to do: > > %hash = @array; > >But it don't work :) > > Every other array element is a key and every other one is data. A loop, >could be done, but this every other one thing could get complicated. I think what ur saying

Re: How to: load array into Hash

2006-07-16 Thread $Bill Luebkert
Eric Edwards wrote: > Michael, > As far as I know, that is the way to do it. > Have you tried accessing the hash? I didn't get the orig post yet, so I'll answer on yours. > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > This is what I want to do: > > %hash = @array; > >

RE: How to: load array into Hash

2006-07-16 Thread Charles K. Clarkson
Michael D. Smith wrote: : This is what I want to do: : : %hash = @array; : : But it don't work :) Define "it don't work". #!/usr/bin/perl use strict; use warnings; use Data::Dumper 'Dumper'; my @foo = ( foo => 1, bar => 2, baz => 'three', ); my %foo = @foo; print Dumper \

RE: How to: load array into Hash

2006-07-16 Thread Eric Edwards
: How to: load array into Hash This is what I want to do: %hash = @array; But it don't work :) Every other array element is a key and every other one is data. A loop, could be done, but this every other one thing could get complicated. Must be an easy way

RE: How to: load array into Hash

2006-07-16 Thread Michael D. Smith
This is what I want to do: %hash = @array; But it don't work :) Every other array element is a key and every other one is data. A loop, could be done, but this every other one thing could get complicated. Must be an easy way. ms ___ Perl-Win32-