While reading a log file, I am selecting an ID using reg exp and inserting the ID into a hash as the key and setting the value = 1. The nice thing about using a hash is that it filters out the duplicate ID values. If I wanted to be able to count the number of times each ID occurs, how can I tell if the key previously existed in the hash? If I was doing this in vbscript, I could use a dictionary, an error is produced on attempting to enter a duplicate key and I increment the value. Is this possible in Perl? I have tried
if ($table1{$1} gt '0')
{
$table1{$1} = 2;
}
else
{
$table1{$1} = 1;
}
and all I get is 1 as the value.
Thanks for any and all help,
if ($table1{$1} gt '0')
{
$table1{$1} = 2;
}
else
{
$table1{$1} = 1;
}
and all I get is 1 as the value.
Thanks for any and all help,