in reply to SpreadSheet::ParseExcel Failure to Match Question

Could it be that $sheet->{Cells}[$row][3]->{Val} contains "non-printable" characters that prevent an exact match?

You could check this by inserting a print statement, or simply use =~ instead of eq, eg.

if ($sheet->{Cells}[$row][3]->{Val} =~ m/UPGRADE SOLUTION/) {$upgrade= +1} else {$upgrade=0};
Hope this helps,
Darren :)

Replies are listed 'Best First'.
Re^2: SpreadSheet::ParseExcel Failure to Match Question
by finhagen (Sexton) on May 04, 2009 at 01:09 UTC
    Thanks for the advice. I liked your matching idea - which I thought was promising but unfortunately it didn't seem to work any better than the eq. I have a print out of the variables I use for validation and it shows me that my match isn't working:
    DE: 1002179816 DEDATE: 2009-5-4 OP# 996115 SO# 63170867 0 LINE# 1 1 QTY: 2 2 MODEL: CX-4PDAE-FD 3 DESC: 4G DAE FIELD INSTALL 4 UNIT: EA 5 LIST PRICE: 11800 6 DISCOUNT: 0.000 7 SELL PRICE: 0000 8 REP FLOOR: 0000 9 DM FLOOR: 0000 10 COST: 0000 11 MARGIN: 0.0000 12 MAINTENANCE: 0000 13 COMMENT: Seattle CX3-20 Expansion (30x300 15K) 14 SERIAL# 0 15 BU: IT 16 UPGRADE? 0 17 DEAL# 0

    #14 should be a serial number such as APM1233432445. #16 should be a 1. Looks like there is something a little more complicated a foot. Thanks!

      In that case, I would insert:
      print "==$sheet->{Cells}[$row][3]->{Val}==\n";
      in the appropriate place, so that you can see what the contents of that cell actually are.

      Darren :)