Re: Simplest hash initialization with no value

2007-06-01 Thread Chas Owens
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

Re: Simplest hash initialization with no value

2007-06-01 Thread Paul Lalli
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

RE: Simplest hash initialization with no value

2007-06-01 Thread Nath, Alok (STSD)
$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:

Re: Simplest hash initialization with no value

2007-06-01 Thread Paul Lalli
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

RE: Simplest hash initialization with no value

2007-06-01 Thread Nath, Alok (STSD)
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

RE: Simplest hash initialization with no value

2007-06-01 Thread Nath, Alok (STSD)
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

Re: Simplest hash initialization with no value

2007-06-01 Thread Jeff Pang
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/