On 03/04/2011 18:35, shawn wilson wrote:

so, lets do what you asked (i like hashes better anyway:)  )

my %hash3, %nothash;
my $found = 0;
while( my( $ikey, $ival ) = each( %hash1 ) ) {
    while( my( $jkey, $jval ) = each( %hash2 ) ) {
       if( ( $ikey == $jkey ) and ( $ival == $ikey ) ) {
          $hash3{ $ikey } = $ival;
          $found = 1;
       }
    }
    if( $found == 0 ) {
    %nothash{ $ikey } = $ival;
    $found = 0;
}

not sure if that is any quicker and i just typed it, so it should work, but...

That is poor code and is a very long way from working. There is no exuse
I can think of for not testing a solution like this when the test data
has been provided for you. Be aware that this is - nominally at least -
a beginners group.

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to