I had the -w option on (!/usr/bin/perl -w). When I took out the -w, the mystery
message went away. I'm still a bit disturbed that I ever got it, but the
program runs fine.
Lotto.
.
P.S. Sorry about all of those reposts, it took forever for the posts to appear
for me, and I thought I was doing something wrong during posting.
Eric Lotto wrote:
> Forgive me if this post is a duplicate. I tried sending it through my
> newsgroup reader first, and it did not seem to get through.
>
> I wrote a program (on linux platform) to read in an Excel file, and write
> the data out to a fixed-length field file. I used the ParseExcel module,
> but it loads the entire Excel file into memory. This works great for test
> files, but the files it will actually be used for are much too large.
> So I am now rewriting the program to use the CellHandler with Parse.
> Unfortunately Parse skips cells which are null, which leaves fields out.
> This does not work for a fixed-length file. I think I found a way around
> it, and it is ugly. Furthermore, I get the message "Use of uninitialized
> value at" when I am looping through the missing fields. It is very odd
> behavior (or at least it seems so to me) because if I put the exact same
> line of code in another area, that line will not generate that message.
>
> Here is my subCellHandler:
>
> ****************************************************************
> sub subCellHandler($$$$$) {
> my($ovBook, $ivSheet, $ivRow, $ivCol, $ovCell) = @_;
> if($ivSheet != $sheet){ return;}
> if(($skip != "0") && ($ivRow == 0)){ #skip cells in first
> row (headers)
> $iRow = 1;
> return;
> }
> if($ivCol >= $numCol){ return;} #cell outside of
> requested fields
> while(($iCol != $ivCol) || ($iRow != $ivRow)){
> $iCol++;
> if($iCol > $numCol){ #new row
> print OUTFILE "\n";
> $iRow++;
> $iCol = 0;
> }
> if(($iCol != $ivCol) || ($iRow != $ivRow)){ #if still unequal,
> have blank cell(s)
> print OUTFILE " " x ($colWidth[$iCol]);
> }
> } #end of while($iCol...)
> $printValue = $ovCell->Value;
> $lengthDif = $colWidth[$ivCol];
> $lengthDif = $lengthDif - length($printValue);
> if($lengthDif > 0){ $printValue = $printValue . " " x $lengthDif; } #pad
> field with spaces
> elsif($lengthDif < 0){ #cell value is too big to
> fit in fixed field
> $strChopped = "";
> for(my $i = 0; $i > $lengthDif; $i--){ $strChopped = chop($printValue) .
> $strChopped; }
> print STDERR "String \"$strChopped\" removed from end of Row:",
> $ivRow+1, " Column:", $ivCol+1, "\n";
> }
> print OUTFILE $printValue
> or die "Error printing cell: R:", $ivRow+1, " C:", $ivCol+1,"\nAborting
> conversion.\nErrored out ";
> } #End of subCellHandler()
> ****************************************************************************
> *
> The mystery message seems to come from the line with the "if still unequal,
> have blank cell(s)" comment.
>
> Thank you much,
> Lotto.
> .
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]