>
> Sorry, I messed some thing. Can you please explain the code? . You
> explanation will give more idea to learn the below hash usage.
>
>>
>> my @regions = ('east','north','south','west');
>> my @statuses_string = ('pws','open','hold','pwu','reopen');
>> my %region_data;
>> foreach my $region (@regions) {
>> foreach my $status_string (@statuses_string) {
>> $region_data{$region}{status}{$status_string}{count} = 0;
>> }
>> $region_data{$region}{total_count} = 0;
>> }
>> print Dumper \%region_data; # inspect the pristine data structure
>
>
>> sub ByRegion
>> {
>> my @columns=@_;
>> $regions{ lc($columns[1]) }{status}{ lc($columns[2]) }c++;
>> $regions{ lc($columns[1]) }{total_count}++;
>> }
>>
>>
> And also gives the below error.
>
> Bareword found where operator expected at ./demo.pl line 25, near "}c"
> (Missing operator before c?)
> syntax error at ./demo.pl line 25, near "}c"
> syntax error at ./demo.pl line 29, near "File
>
>
Hi Leo,
Sorry . The below line works fine. It is {count}++
$region_data{ lc($columns[3]) }{status}{ lc($columns[0]) } { count}++;
$region_data{ lc($columns[3]) }{total_count}++;
Thanks for you time !!!.
Thanks & Rg
Mohan L
Thread Previous