On Wed, 17 Nov 2004 15:59:54 -0600, Dave Kettmann <[EMAIL PROTECTED]> wrote: > > > > Hello everyone, > > > > I have an if statement that has three different clauses that need to > > be met before it should be executed, and for some reason I can't get > > the conditionals to work. Here's the snip of code: > > > > print "STCode: > > ",$activity->child("Status")->child("StatusType")->child("Code > > ")->value,"\n"; > > # This line prints I > > print "SCCode: > > ",$activity->child("Status")->child("StatusCode")->child("Code > > ")->value,"\n"; > > # This line prints DS > > > > if ( > > $activity->child("Status")->child("StatusType")->child("Code")->value > > eq 'D' || > > $activity->child("Status")->child("StatusCode")->child("Code")->value > > eq 'DS' && > > defined > > $activity->child("ActivityLocation")->child("Address")->child( > > "AddressLine1") > > ) { > > print "*********IT WAS DELIVERED*******\n"; > > } > > > > I'm parsing some XML via XML::SimpleObject and even though > > $activity->child("Status")->child("StatusCode")->child("Code")->value > > is DS and > > $activity->child("ActivityLocation")->child("Address")->child( > > "AddressLine1") > > is defined I can't get this to print the "it was delivered" string. > > > > I have tried placing parenthesis around the logical OR > > statement as well: > > > > if ( > > ($activity->child("Status")->child("StatusType")->child("Code")->value > > eq 'D' || > > $activity->child("Status")->child("StatusCode")->child("Code")->value > > eq 'DS') && > > defined > > $activity->child("ActivityLocation")->child("Address")->child( > > "AddressLine1") > > ) { > > print "*********IT WAS DELIVERED*******\n"; > > } > > > > Still no luck. > > > > Can someone tell me what I'm doing wrong? > > > > All help is appreciated, > > Kevin > > -- > > Kevin Old > > [EMAIL PROTECTED] > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > I'm very new to perl still, but looks like in your if statement .. you are > using OR ( || ) not AND ( && ) .. Just a thought? may not be right though :)
Yes, Dave, that's the answer to my question. Unfortunately, I did not state my problem correctly. I need only 1 of the first two conditions to be met (hence the OR ( || ) ) and the third to be met (hence the AND ( && ). Sorry for the confusion. Thanks, Kevin -- Kevin Old [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>