Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Out of memory and While replacements with excel XLSX application

by Anonymous Monk
on Oct 08, 2012 at 09:29 UTC ( #997792=note: print w/ replies, xml ) Need Help??


in reply to Re: Out of memory and While replacements with excel XLSX application
in thread Out of memory and While replacements with excel XLSX application

Here is a start at refactoring

diff fudge fudge2

diff fudge2 fudge3

diff fudge3 fudge4

--- fudge3 2012-10-08 02:22:02.328125000 -0700 +++ fudge4 2012-10-08 02:21:58.968750000 -0700 @@ -142,115 +142,11 @@ push @prod, $val; } - if ( my $val = eval { $Sheet->Cells( $row, 13 )->{Value} } ) { + for my $col ( qw{ 13 14 15 17 18 20 21 22 23 24 25 26 27 32 3 +9 32 33 34 35 36 37 38 39 }){ + if ( my $val = eval { $Sheet->Cells( $row, $col )->{Value +} } ) { push @prod, $val; } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 14 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 15 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 17 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 18 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 20 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 21 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 22 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 23 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 24 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 25 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 26 )->{Value} } ) { - - push @prod, $val; - } - - #same - if ( my $val = eval { $Sheet->Cells( $row, 27 )->{Value} } ) { - - push @prod, $val; - } - - #32-39 production data - if ( my $val = eval { $Sheet->Cells( $row, 32 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 33 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 34 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 35 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 36 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 37 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 38 )->{Value} } ) { - - push @prod, $val; - } - if ( my $val = eval { $Sheet->Cells( $row, 39 )->{Value} } ) { - - push @prod, $val; } }

diff fudge4 fudge5

diff fudge5 fudge6

diff fudge6 fudge7

diff fudge7 fudge8

diff fudge8 fudge9

diff fudge9 fudge10

I end up with fudge10


Comment on Re^2: Out of memory and While replacements with excel XLSX application
Select or Download Code
Re^3: Out of memory and While replacements with excel XLSX application
by Anonymous Monk on Oct 08, 2012 at 09:41 UTC
    ValueTargetCols should loop over rows first then cols, but it probably makes no difference in the results in this case

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2014-08-01 12:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (12 votes), past polls