Fellow monks,

I'm working on an application that is parsing information from a web page - specifically tables on said page. All is working just fine until I push the data on to my HoA. The data appears correct in the data structure - I've watched it running under the Tk Debugger. As far as I can tell from what I've read, if I read correctly, Perl thinks that some of the data isn't defined in my anon hash. I realize I can "ignore" this by turning off warnings but I'd rather get to the bottom of the problem before I turn off warnings.

As my code shows I'm setting values to a physical space if there's a html space on the table cell.

My code is as follows:
sub process_info{ my ($temp, $year, $info); do {($token = $stream->get_token)} until $token->[0] eq "C" and $t +oken->[1] =~ /1958/; while($token = $stream->get_token) { if ($token->[0] eq "S" and ${$token->[2]}{year}){ $year = ${ +$token->[2]}{year} } if ($token->[0] eq "S"){ if (${$token->[2]}{id}){ $temp = &get_token("td"); my @names = split(" ",$temp); $info->{last} = pop(@names); $info->{first} = join( " ", @names ); $temp = &get_token("td"); if ($temp eq " "){ $info->{addr} = ''; } else{ $info->{addr} = $temp; } $temp = &get_token("br"); if ($temp eq " "){ ($info->{city}, $info->{state}, $info->{zip}) + = ('', '', ''); } else{ my $t2; ($info->{city}, $t2) = split(', ',$temp); ($info->{state},$t2) = split(" ",$t2); $t2 =~ s/\s+//; $info->{zip} = $t2; } $temp = &get_token("td"); if ($temp eq " "){ $info->{phone} = ''; } else{ $info->{phone} = $temp; } $temp = &get_token("a"); if ($temp eq " "){ $info->{email} = ''; } else{ $info->{email} = $temp; } push( @{$bros->{$year}}, $info); $info = {}; # reset $info hash } # end ${$token->[2]}{id} } # end $token->[0] eq "S" } # end while } # end sub

And a sample of the HTML I'm parsing:

<!-- Start 1958 --> <TR id="start"> <TD>Rusty Bartel</TD> <TD>&nbsp;<BR>&nbsp;</TD> <TD>&nbsp;</TD> <TD><A HREF="">&nbsp;</A></TD> </TR> <TR id="start"> <TD>Charles Brown</TD> <TD>123 Main Ave<BR>Sebastopol, CA 95472</TD> <TD>&nbsp;</TD> <TD><A HREF="">&nbsp;</A></TD> </TR> <TR id="start"> <TD>Ardon Milkes</TD> <TD>345 George Dr<BR>Springfield, VA 22152</TD> <TD(503) 555-1212</TD> <TD><A HREF="mailto:me@nobody.com">me@nobody.com</A></TD> </TR>

I've even tried putting in a '?' so I wouldn't have a physical space if that was what was throwing the warning, but that didn't work either. As far as I can tell, all the data in the anon hash is filled before I push it.

Can anybody shed any light on this?

TIA!

There is no emoticon for what I'm feeling now.

In reply to Pushing anon hash on to HoA structure giving Use of uninitialized value in hash element error using warnings by Popcorn Dave

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.