chiel wrote: > > I have a quick question. I use the following line, and this works ok: > > if ($$result_t{$operating_descr.".".$index} =~ /PCMCIA/ && $tmp_status == 3) > { > > > > But if I change it to the following: > > if ($$result_t{$operating_descr.".".$index} =~ /PCMCIA/ || /USB/ && > $tmp_status == 3) {
First of all, I would replace the noisy and obscure $$result_t{$operating_descr.".".$index} with $result_t->{"$operating_descr.$index"} > I get errors like: > > Use of uninitialized value in pattern match (m//) That is because you have written $$result_t{$operating_descr.".".$index} =~ /PCMCIA/ || /USB/ and in the absence of an object string, /USB/ is being applied to $_, which must be undefined at that point in the script. You should write $result_t->{"$operating_descr.$index"} =~ /PCMCIA|USB/ but remember that your regular expression tests only whether your object string /contains/ either 'USB' or 'PCMCIA'. If you should be checking for equality then something like this is better, and reads much more fluently: { my $descr = $result_t->{"$operating_descr.$index"}; if (($descr eq 'USB' or $descr eq 'PCMCIA') and $tmp_status == 3)) { : } } HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/