something like:
foreach my $key( keys %hashA ){
if( $hashB{$key}){ print"do the dance of joy, duplicate key found" }
}
should do the trick.
"Aimal Pashtoonmal" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello people,
>
> Can any one please help me. I have 2 hashes, hashA and hashB, the keys
> in both cases, are made up of a mixture of numbers and words etc. But
> the keys are differnt so I presume I cannot use if exits or if defined.
>
> Is there anyway of check to see if the words and numbers making up the
> keys of hashB are present in the keys of hashA?
>
> ie:
>
> initially I check if a certain word is present in key of hashA, such as
> "if ( $key =~ /WORD1/ ) { ....
>
> then the key of hashA looks like: "12334RET 456 WORD1 W56778
> sp_entry 14 30 0.001 T" (the value for this key is say
> "1234.1")
> and
> the corresponding key of hashB looks like: "1234.1 A1 sp_entry
> 14 30 0.001" (the value for this key is say "1234.1.A1" )
>
> What I am trying is if the key of hashA contain s "sp_entry" && "14"
> && "30" && "0.001" ; then to print the value held by the current key
> of hashB ("1234.1.A1") followed by the entire current key of hashA
> ("12334RET 456 WORD1 W56778 sp_entry 14 30 0.001
> T") so that the final output is:
> "1234.1.A1 12334RET 456 WORD1 W56778 sp_entry 14
> 30 0.001 T" (all on the same line). The mixture of words and
> numbers in the keys are seperated by a tab.
>
> Thanks in advance for reading and reading with a reply.
>
> cheers all, amal
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]