I am having problems with what I thought was a pretty simple script. The errors I get are
Use of uninitialized value in concatenation (.) or string at ./fund.pl + line 25, <STDIN> line 1. Use of uninitialized value in concatenation (.) or string at ./fund.pl + line 28, <STDIN> line 1. Use of uninitialized value in concatenation (.) or string at ./fund.pl + line 32, <STDIN> line 1. Use of uninitialized value in concatenation (.) or string at ./fund.pl + line 32, <STDIN> line 1. Use of uninitialized value in transliteration (tr///) at ./fund.pl lin +e 47, <STDIN> line 9535. Use of uninitialized value in concatenation (.) or string at ./fund.pl + line 48, <STDIN> line 9535.
I am unsure what is causing this error and any help would be appreciated. The script is below.
#!/usr/bin/perl -w ###### usage: cat inputfile | abiglobal.pl $i=0; while ($_ = <STDIN>) { if(/(FUND ACTIVITY REPORT)/ ) { $input=$_; chop($input); $fundcode=substr($input,0,5); $fundcode=~ s/ //g; $input=~ tr/\"//; $input=~ tr/\'//; # $input=~ tr/,/\t/; $input=~s/REPORT,/REPORT /g; $input=~s/ / /g; @in=split(/ /,$input); # @fund=$in[0]; if($i=="0"){ $final=$in[3].".html"; open (OUT,">>body.txt") || die "I am not able to write to file"; open (HEAD,">>head.txt") || die "not able to open temp header"; print HEAD "<HTML><HEAD><TITLE>Fund Activity Report</TITLE></HEAD> +<BODY><TABLE border=1><tr><td><strong>Fund Activity Reports: $in[3] +</strong></td></tr><TR><td valign='top'><a href='#$fundcode'>$fundcod +e</a>&nbsp;\n"; $i=99; } print HEAD "<a href='#$fundcode'>$fundcode</a>&nbsp;\n"; print OUT "<strong><a name='$fundcode'>Fund: <u>$in[0]</u> </a>Fun +dInfo: <u>$in[1] $in[2]</u></strong><br>\n"; } else { print OUT "<pre>$_</pre>\n"; } } #### end while stdin print HEAD "</td></tr></table><br><br>\n"; print OUT "</body></html>\n +"; close OUT; close HEAD; #$outfile=~tr/ /_/; $outfile=~tr/,/_/; print "$outfile\n"; system "cat head.txt body.txt >>/home/fundlist/test/$final"; system "r +m head.txt"; system "rm body.txt"; opendir(DIR, "./public_html"); open (OUT,">/home/fundlist/test/index.html") || die "I am not able + to write to file"; print OUT ("<HTML><HEAD><TITLE>Fund List Director +y</TITLE></HEAD><BODY>\n"); print OUT ("<h4>Directory Listing</h4>\n"); while($file = readdir(DIR) ) { print OUT ("<A HREF=\"$file\">$file<br>\n"); } print OUT ("</body></html>\n"); closedir(DIR); close (OUT);

In reply to Uninitialized value in concatenation by eiglesias

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.