Uninitialized values for arrays suddenly appear in early
subs after I created private var in last sub. I am
really trying to be clear! The script searches html files
for terms input by a form. I am trying to add code which
would append the search results HTML to an open ended
block of HTML called top.html The script was working fine until
I added this to the fourth sub at around line 150:
open(FH,"../top.html") || die "couldn't open file $!\n"; my @html=<FH>; close(FH); print @html;
Now I get unitialized values for:
 @pairs = split(/&/, $buffer); at line 34 in the first sub

 @terms = split(/\s+/, $FORM{'terms'}); at line 71 in the third sub

The arrays aren't declared in the variable declarations but this caused
no errors until I added the private variable. BTW the little block of code I
added works fine as a standalone (thanks to mandog)
I suspect this is too vague to be answered but I really hope someone can help!
TIA
jg

In reply to uninitialized values for arrays suddenly appear by jerrygarciuh

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.