I keep running into an uninitialized error that doesnt make sense to me, I should be writing the state in column 6, but I keep getting
Use of uninitialized value $t[6] in string eq at Project1_6.pl line 48 +, <FH> line 2551. Use of uninitialized value $t[6] in string eq at Project1_6.pl line 42 +, <FH> line 2552.
Used perl c- it runs, says syntax is okay I tried declaring $t in line 35, "$worksheet->write($rowCount1+1, $_, my $t[$_]);"
Perl C- said that was okay, but I get "syntax error at Project1_6.pl line 37, near "$t[""
use Excel::Writer::XLSX; use strict; use warnings; my $rowCount = 0; my $filename = "Output2022.xlsx"; my $workbook = Excel::Writer::XLSX->new( $filename ); open(FH, "<", "SRC185.xlsx" ) or die; my $worksheet = $workbook->add_worksheet('List'); $worksheet->write(0, 0, "source_id" ); $worksheet->write(0, 1, "first_name" ); $worksheet->write(0, 2, "middle" ); $worksheet->write(0, 3, "last_name" ); $worksheet->write(0, 4, "address1" ); $worksheet->write(0, 5, "city"); $worksheet->write(0, 6, "state"); $worksheet->write(0, 7, "postal_code"); $worksheet->write(0, 8, "phone_number"); $worksheet->write(0, 9, "address3"); $worksheet->write(0, 10,"province"); $worksheet->write(0, 11, "email"); my $rowCount1 = 0; my $t=0; my @z = 90005; while (<FH>){ chomp; my @t=(',',$_); if(defined($t[8])){ my $Count=0; $worksheet->write($rowCount1+1, $_, $t[$_]); $Count++; } elsif($t[6] eq "CA" && $t[7] eq !defined) { $worksheet->write($rowCount1+1, 7, $z[7]); } $rowCount1++; } $workbook->close(); close(FH);

In reply to Parsing error by MoodyDreams999

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.