On Wed, Jul 13, 2011 at 11:30 PM, Leo Susanto <leosusa...@gmail.com> wrote:
> Mohan, > > I would suggest you learning perl hash: http://perl101.org/hashes.html > Yes. I will learn the perl hash. > > #!/usr/bin/perl > use Text::CSV; > use DBI; > use Data::Dumper; > > # CONFIG VARIABLES > ... > # DATA SOURCE NAME > ... > 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 Thanks & Rg Mohan L