On 10/19/06, Robert Hicks <[EMAIL PROTECTED]> wrote:
I am currently building the IF statement like: if ($project_name eq 'Proj1' || $project_name eq '' && $task_name eq '')
Because logical-and is higher precedence than logical-or, that condition is the same as this: $project_name eq 'Proj1' || ($project_name eq '' && $task_name eq '') Is that what you want? I think you might be expecting different grouping: ($project_name eq 'Proj1' || $project_name eq '') && $task_name eq ''
That works but I was wondering if I can do this: if ($project_name eq ('Proj1' || '') && $task_name eq '')
Maybe someday in Perl 6, but not here today. Of course, you could use a pattern match instead of string equality to do something similar: $project_name =~ /^(Proj1)?$/ and $task_name eq '' Or you could use a subroutine: &any_match($project_name, 'Proj1', '') and $task_name eq '' TMTOWTDI. I'm sure other variants will be posted as well. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>