in reply to Re: Hash loop debugging.
in thread Hash loop debugging.

I have a loop (for each entity in hash '%dep'). Inside that loop I am adding a variable to %dep2. When I print off all values in %dep2, I only have 1 member of the hash. This isn't supposed to happen because %dep has a ton of members in it's hash.

Replies are listed 'Best First'.
Re^3: Hash loop debugging.
by repellent (Priest) on Apr 27, 2009 at 22:27 UTC
    Let's take it from the top:
    my $mech = WWW::Mechanize->new(); my $stream = HTML::TokeParser->new(\$html); my $streamm = HTML::TokeParser->new(\$htmll); my $streammm = HTML::TokeParser->new(\$htmlll); my %dep; my %dep2; my @coursename; $mech->get($url); $html = $mech->content();

    You need to declare $html, $htmll, etc. prior to initializing $stream, $streamm, etc.
    Fix that first, and update the code.

    Please use strict; It would have caught undeclared variables.

    Also heed the advice at: How do I post a question effectively?