http://www.perlmonks.org?node_id=812002


in reply to Report File Extract

First, decide how you want to store your data. Then decide how to populate your data structure. I would do something along the lines of a dispatch table populating a hash, like so:

my %dispatch = ( 'SALES ' => \&do_sales_stuff, 'GROSS PROFIT $' => \&do_gpdollar_stuff, 'GROSS PROFIT %' => \&do_gppercent_stuff, 'AVG. SALES/RO ' => \&do_avgsales_stuff, 'TOTAL HOURS ' => \&do_hours_stuff, 'AVG. HOURS/RO ' => \&do_avghours_stuff, 'ETC, ETC, ETC ' => \&do_whatever, ); my $salesperson; my %data; while(<>) { my $rowid = substr $_, 0, 14; next if $salesperson = discard_header_or_get_new_salesperson($_); ($dispatch{$rowid} || \&unhandled stuff)->(\$data{$salesperson}, $_) +; }

@_=qw; Just another Perl hacker,; ;$_=q=print "@_"= and eval;