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
$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
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
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
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
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
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
$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
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
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;
>
>
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 \
Michael,
As far as I know, that is the way to do it.
Have you tried accessing the hash?
Eric
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Michael D. Smith
Sent: Sunday, July 16, 2006 7:26 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: RE: How
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-
13 matches
Mail list logo