On 5 August 2010 03:39, John W. Krahn <[email protected]> wrote:
> 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?
>
then $type_g contains the value of $options{$key}->[4]
>> any idea on the reasons for this behaviour
>
> What is in $chk and $type at this point in time?
>
>
>
output
type $chk
type_g_within_loop ogg key3 Audio CD Files
type_g_within_loop ogg key3 Flash
type_g_within_loop ogg key3 DVD half
type_g_within_loop Audio ogg key3 ogg
type_g_within_loop Audio ogg key3 To amr Wb
type_g_within_loop Audio ogg key3 Fix DVB
type_g_within_loop Audio ogg key3 VCD reduced size
type_g_within_loop ogg key3
type_g_within_loop ogg key3
type_g_within_loop ogg key3 To mp3
type_g_within_loop ogg key3 VCD
type_g_within_loop ogg key3 DVD Standard
type_g_within_loop ogg key3 DVD Half qual
type_g_within_loop ogg key3 DVD Music
type_g_within_loop ogg key3 avi dvd size ffmpeg
native
> 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: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/