Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Report File Extract

by bv (Friar)
on Dec 09, 2009 at 19:02 UTC ( #812002=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://812002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2019-12-07 18:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Strict and warnings: which comes first?



    Results (162 votes). Check out past polls.

    Notices?