Mike Martin wrote:
Hi

Hello,

I have the following code
my $type='val';
my $type_g;
foreach my $key (keys %options){
my $chk=$options{$key}->[3];
$type_g=$options{$key}->[4] if $chk=~/$type/;
#$type_g=$options{$key}->[4] if $type=~/$chk/;
}
print "\n",$type,"\t",$type_g,"\n";

This fails but if I replace
$type_g=$options{$key}->[4] if $chk=~/$type/

with either
$type_g=$options{$key}->[4] if $type=~/$chk/; (ie:reversing the match)

or

$type_g=$options{$key}->[4] if $type eq $chk;

Yes, ... and then what happens?

any idea on the reasons for this behaviour

What is in $chk and $type at this point in time?



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
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