b0VIM 6.3\C^@WLawwaiidfeline.thelackthereof.org/var/www/projects/perl/epfarms-finances/import_from_paypal.pl3210#"! Utpoado]\* x\[M:+ x v u k j J .  X @ / .  c ; i D 9   T 9  q!urqW;XM$print "done.\n";} }print "done.print "done.\n"print "done.\n";} } print $err (join(',', @outrow)) . "\n"; @outrow = map {'"' . $_ . '"'} @outrow; my @outrow = @rowhash{@export_cols}; } else { print $out (join(',', @outrow)) . "\n"; @outrow = map {'"' . $_ . '"'} @outrow; my @outrow = @rowhash{'username', @export_cols}; if($rowhash->{username}) { my %rowhash = %$rowhash;foreach my $rowhash (@data) {print "Dumping results...";# Now we dump the results);'Currency','Gross','Fee','Net'my @export_cols = ('From Email Address', 'Time', 'Date','Transaction ID',print "done.\n";} } } $rowhash->{username} = $user; #print " applied rule to column " . $rowhash->{'Transaction ID'} . "..."; if($rowhash->{$col} =~ /$regex/i) { foreach my $rowhash (@data) { #print "\n Trying rule: '$col', '$regex', '$user'..."; my ($col, $regex, $user) = @row;while(my @row = getline($rules)) {print "Applying rules...";# Now we go through the rules and assign usernames to each rowprint "done.\n";@data = @combined_data;} push @combined_data, $data[$ref{$id}];foreach my $id (keys %ref) {} } $ref{$data[$i]->{'Transaction ID'}} = $i; } else { $row->{Net} += $data[$i]->{Net}; $row->{Fee} += $data[$i]->{Fee}; $row->{Gross} += $data[$i]->{Gross}; $row->{Currency} = $data[$i]->{Currency}; my $row = $data[$ref{$ref_id}]; my $ref_id = $data[$i]->{'Reference Txn ID'}; if($data[$i]->{'Reference Txn ID'}) { next if defined $ref{$data[$i]->{'Transaction ID'}}; next if $data[$i]->{Type} =~ /^Update to .*$/;for(my $i = 0; $i < $#data; $i++) {my @combined_data;my %ref;print "Combining related rows...";print "done.\n";@data = reverse(@data);print "Reversing data (to get a better date order)...";print "done.\n";} push @data, $rowhash; } $rowhash->{$col} = shift @row; foreach my $col (@cols) { my $rowhash;while(my @row = getline($in)) {print "Sucking in file...";# Now we suck in the whole filemy @data;} print "Col: '$col'\n";foreach my $col (@cols) {my @cols = getline($in);} return @content; } @content = ($line =~ /\s*"?(.*?)"?(?:,|$)/g); if(my $line = <$file>) { my @content; my ($file) = @_;sub getline {open($rules, "$rulesfile");open($err, ">$errfile");open($out, ">$outfile");open($in, "$infile");$rulesfile = 'data/paypal-rules.csv';$errfile = 'data/paypal-bad.csv';$outfile = 'data/paypal-ok.csv';$infile = 'data/all-epfarms-paypal-20051008.csv';use vars qw( $in $out $err $rules );use vars qw( $infile $outfile $errfile $rulesfile );$| = 1;use Data::Dumper;use IO::Handle;use strict;#!/usr/bin/perl