regards
George
- Original Message -
From: Capacio, Paula J [EMAIL PROTECTED]
To: Perl-Win32-Users (E-mail) [EMAIL PROTECTED]
Sent: Friday, December 06, 2002 10:58 PM
Subject: AutoIncrement hash value
$hash{'A'} = '0';
#why doesn't this work...
$hash{'A'} = $hash{'A'}++;
#isn't
I was using a hash to accumulate occurrences of a string (jobnames) in the file and I
tried to use ++ to auto increment; but it didn't work. Since TMTOWTDI, I found an
easy solution but I'm just curious as to why this doesn't work. Shouldn't the value
of key 'A' be 2?; why doesn't ++ work or
-Original Message-
From: Capacio, Paula J [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 2:59 PM
To: Perl-Win32-Users (E-mail)
Subject: AutoIncrement hash value
I was using a hash to accumulate occurrences of a string
(jobnames) in the file and I tried to use
-Original Message-
From: Capacio, Paula J [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 2:59 PM
I was using a hash to accumulate occurrences of a string
(jobnames) in the file and I tried to use ++ to auto
increment; but it didn't work. Since TMTOWTDI, I found an
-Original Message-
From: Capacio, Paula J [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 06, 2002 3:59 PM
#why doesn't this work...
$hash{'A'} = $hash{'A'}++;
#isn't it logically equivalent to this?
$hash{'A'} = $hash{'A'}+1;
You can simply use:
$hash{'A'}++;
or: