brcjacks has asked for the wisdom of the Perl Monks concerning the following question:
I have a string named $rule_text an it contains:
How can I use that in an if statement? Obviously if I just do this: if $rule_text {...} it'll evaluate as true as long as it's not an empty string but that's not correct. I want to know if that string evaluates as true or false and set a flag variable as appropriate. I was hoping that this would work:($field[6] eq 'PM' && $field[8] eq 'CAVENDI')
but no luck.$ignore_flag = eval if $rule_text;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: testing an if statement in a string
by Limbic~Region (Chancellor) on Oct 31, 2013 at 14:20 UTC | |
by brcjacks (Initiate) on Oct 31, 2013 at 14:59 UTC | |
Re: testing an if statement in a string
by LanX (Saint) on Oct 31, 2013 at 14:18 UTC | |
by brcjacks (Initiate) on Oct 31, 2013 at 14:58 UTC | |
Re: testing an if statement in a string
by pajout (Curate) on Oct 31, 2013 at 14:24 UTC | |
by LanX (Saint) on Oct 31, 2013 at 15:43 UTC | |
by brcjacks (Initiate) on Oct 31, 2013 at 15:03 UTC | |
by AnomalousMonk (Archbishop) on Oct 31, 2013 at 23:14 UTC | |
Re: testing an if statement in a string
by Laurent_R (Canon) on Oct 31, 2013 at 15:21 UTC |
Back to
Seekers of Perl Wisdom