in reply to Hash print problems

That should work .. how is %evals set? are you sure you didn't do something that altered the hash contents? What does a use Data::Dumper; print Dumper \%evals; show?

Replies are listed 'Best First'.
Re: Hash print problems
by MonkPaul (Friar) on Jul 23, 2005 at 15:30 UTC
    Ah, i have a problem. The Data::Dumper shows the same value in the hash key and value. I havent changed the assignment though.

    Furter investigation is required.

    Here is the call method:

    %evals = parseFiles::getEvals(); print Dumper \%evals;

    and here is the assignment:

    for(my $i = 0 ; $i<scalar @blastLine; $i++) { if ($blastLine[$i] =~ /^>/) { $counter = 0; $current_subject = $blastLine[$i]; chomp ($current_subject); push (@subjects, $current_subject); $alignment->{$current_subject} = ""; ### assignment here for key value#### $evals{$current_subject} = $blastLine[$i]; } $alignment->{$current_subject} = $alignment->{$current_subject}.$b +lastLine[$i]; if($blastLine[$i] =~ /\bScore/) # check to see if the current line points to the e-value { $counter++; my @tempArray = split(",",$blastLine[$i]); # chop the line into an array for processing $tempArray[1] =~ s/(Expect|Expect\(2\))\s=\s//g; #strip off an +y digits,spaces, or = signs to get just e-value if($counter eq 1) { ### assignment here for value#### $evals{$current_line} = $tempArray[1]; } } }

    this shows:

    $VAR1 = { '>gi|19908487|gb|AF343350.1|' => '>gi|19908487|gb|AF343350.1 +|'
      I'm probably missing your intent here, but I see that you:
      $current_subject = $blastLine[$i];
      and then you:
      $evals{$current_subject} = $blastLine[$i];

      This looks like it would produce a hash with matching key and value.
        Yes, i see you point. A bit pointless. I think the value is modified later on though to tempArray[0]. I took out those lines though to ovoid later confusion in my code,

        thanks.