> 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 :) Dave Kettmann NetLogic 636-561-0680 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>