On 6/1/07, Nath, Alok (STSD) <[EMAIL PROTECTED]> wrote:
But when decalared this way it gives a warning message :"Use of
uninitialized value in concatenation (.) or string at"
in a print statement which is something like this :
my %myhash = map { $_ => undef } qw/A B C D E F G H
On Jun 1, 8:02 am, [EMAIL PROTECTED] (Alok Nath) wrote:
> -Original Message-
> From: Paul Lalli [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 01, 2007 4:39 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: Simplest hash initialization with no value
>
> On J
$key (%myhash){
print $myhash{$key}
}
-Original Message-
From: Paul Lalli [mailto:[EMAIL PROTECTED]
Sent: Friday, June 01, 2007 4:39 PM
To: beginners@perl.org; [EMAIL PROTECTED]
Subject: Re: Simplest hash initialization with no value
On Jun 1, 6:
On Jun 1, 6:08 am, [EMAIL PROTECTED] (Alok Nath) wrote:
> Why it gives syntax error when -
> my @myhash{qw/A B/} = ();
Er... because it's not valid syntax. That's why you'd get a syntax
error. Not sure what you're asking. You can't "declare" a hash slice.
You declare variables.
> It wor
PM
To: Nath, Alok (STSD)
Cc: beginners@perl.org
Subject: Re: Simplest hash initialization with no value
Nath, Alok (STSD) 写道:
> Hi,
> What is the simplest way to initialize the hash keys with no values ?
>
> I know the crude form :
>
> %myh
Thanks Jeff.
-Original Message-
From: Jeff Pang [mailto:[EMAIL PROTECTED]
Sent: Friday, June 01, 2007 3:21 PM
To: Nath, Alok (STSD)
Cc: beginners@perl.org
Subject: Re: Simplest hash initialization with no value
Nath, Alok (STSD) 写道:
> Hi,
> What is the simplest way to init
Nath, Alok (STSD) 写道:
Hi,
What is the simplest way to initialize the hash keys with no
values ?
I know the crude form :
%myhash =('A' => undef,
'B' => undef) ;
Is there anything simpler than this ?
Thanks,
Alok
Maybe you want,
@myhash{qw/