in reply to Re^2: why aren't I see the hash while using dump?
in thread why aren't I see the hash while using dump?

hopefully, I formatted this correctly. stuck while reading in the second keys and values of 2nd file and checking against the existing hash key and value can you help debug this piece?

uno = uno due = dos tre = tres quattro = quatro cinque = cinco
uno = tree due = dos tre = tres quattro = cinco cinque = cinco sei = seis
use strict; use warnings; use Data::Dump qw(dump); use Storable; #don't know how to use this to test yet. my %hash; open my $in, '<',"./test_data.txt" or die "can't open the fi +le:$!\n"; while (<$in>){ chomp; my ($key, $value)= split (/\s*=\s/); $hash{$key}=$value; #it's clear to me now } close $in; #will check against %hash with new keys and values #opening files for read and write open my $in2,'<',"./test_data2.txt" or die "can't open file : $!\n"; open my $out ,'>' ,"./test_data_out.txt" or die "can't open the file f +or write:$!\n"; while (<$in2>){ chomp; my ($key,$value) = split (/\s*=\s/); #splits row into 2 col if exists $hash{$keys}{ dump $out \%hash; } }

Replies are listed 'Best First'.
Re^4: why aren't I see the hash while using dump?
by FreeBeerReekingMonk (Deacon) on Jun 02, 2015 at 07:59 UTC


    my ($key,$value) = split (/\s*=\s/);
    if exists $hash{$keys}{
       dump $out \%hash;
    }


    Are you using use strict; use warnings; ? That would immediately tell you you are using a variable that has not been declared previously.
    Please use that from now on...

      I am using the strict but didn't understand exactly what it wanted. I know now.

      I am using netbeans, would you recommend for me to stay on netbeans or use eclipse? I read somewhere that eclipse has a nice debugger walker and I haven't seen one for netbeans.

      by the way, I apologize for wrongful formats and basic questions but this will be improving...I find Perl to be a cool tool and ,also, still figuring out all these tools at PerlMonks on how to communicate effectively. thanks

        Here at work they swear by eclipse, however, look around, test everything, and use what you like.
        We have emacs users that like to run and edit in the same gui, we have vi users that can do vodoo with code (see link , later), we have notepad++ users (that is what I use)... in the end, what do you feel comfortable with? Use that!
        There are some payed editors that are great to use. Look at those too!

        I like no startup time to start typing, hence I use small editors, like Mousepad
        It has syntax highlighting, a feature I am accustomed to.
        (on the image there is a OpenPandora, it runs perl just fine, version 5.8.8 by default, or 5.17.6 if you open the toolchain).

        Example: Look at what Damian does with vim: Damian Conway, "More Instantly Better Vim" - OSCON 2013 (I was awestruck. But note that the vi learning curve is steeeep)

        JUST PLEASE DO NOT USE: edlin