Hells Bells! Line 66 is the for loop head and it throws me the error in the title. I got no warnings!<q>perl -w inventur.pl</q> remains silent. Excel opens, the sheet is selected, the sheet is unprotected and the last_row variable contains 282 as expected.

Can you see any syntax errors or violations? What is causing this error? Any help is highly appreciated.

my @typen = ("Befestigungsmaterial", "Ausbaumaterial", "Hls", "Install +ation", "Profilholz", "Spanplatten", "Dachstuhlholz", "Deckenbalken", + "Wandelementholz", "Giebelbau", "Wandfertigung", "Individual"); ### MAIN ### excellent(@typen);
sub excellent{ my $filename = cwd . "/" . "inventur.xls"; #dateiname my $excel = CreateObject OLE "Excel.Application"; #excel-objekt er +stellen $excel -> {Visible} = 1; #parameter festlegen $excel->{DisplayAlerts}=0; my $workbook = $excel -> Workbooks -> Open($filename); # Arbeitsma +ppe öffnen foreach my $tbl (@_) { # Sheet selektieren my $sheet = $workbook -> Worksheets("$tbl"); $sheet -> Select; # Unprotect Sheet $sheet->Unprotect(); # leere Zeilen löschen our $last_row = $sheet -> Range("D1000")->End(xlUp)->Row; # le +tzte Zeile ermitteln for(my $i=11;$i<=$last_row;$i++) { if( $sheet->Range("D" . $i)->{Value} eq "0") { $sheet->Cells($i, 4)->EntireRow->Delete; } # Leerzeichen in Spalte entfernen #$sheet->Range("Q" . $i)->{Value}->Replace(What => " ", Re +placement => ""); } # Speichern und Schließen $workbook->SaveAs({Filename => cwd . "/$tbl.csv", FileFormat => xlCSV}); } $workbook->Close(); $excel->Quit(); }

In reply to CODE REVIEW: Use of uninitialised value in string eq at inventur.pl line 66 - Can't use an undefined value as a HASH reference at inventur.pl line 66. by timunix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.