Re: Q: Analyse data and provide a report - Arrays?
Thanks very much.
I'm having a bit of drama within my parsing loop.
If I'm trying to look for a specific pattern [ie. tcp] then I am able to
find it [by printing a 'found' message]. This message is then printed each
and every time 'tcp' is found [for a total of 6 times on 6 separate lines].
The script then finishes.
But if I'm trying to increment the number of times this pattern was found I
get the dreaded error:
Use of uninitialized value in hash element at ...
Here's the code extract:
while (<>) {
my($Proto)=
/(\s+)*$/;
if (/tcp/) {
print 'found';
$Protos{$Proto} ++;
where am I failing ?
Thanks very much.
I'm having a bit of drama within my parsing loop.
If I'm trying to look for a specific pattern [ie. tcp] then I am able to
find it [by printing a 'found' message]. This message is then printed each
and every time 'tcp' is found [for a total of 6 times on 6 separate lines].
The script then finishes.
But if I'm trying to increment the number of times this pattern was found I
get the dreaded error:
Use of uninitialized value in hash element at ...
Here's the code extract:
while (<>) {
my($Proto)=
/(\s+)*$/;
if (/tcp/) {
print 'found';
$Protos{$Proto} ++;
where am I failing ?
Comment