On Thu, 2002-03-28 at 09:44, [EMAIL PROTECTED] wrote: > Hi all, > > > I have some arrays and like to trigger some events depending on which > array or combination of arrays contains data. What I tried was > something like: > snippet > > > if(@dates && !@themes && !@cities) { > > > #do something with the data in @dates > > > } > elsif(!@dates && @themes && !@cities) { > #do somthing with @themes > } > ... > Alas! I doesn't work. Using "and" instead of "&&" doesn't help either. > Or do I have to use "&" instead. Although it doesn't work either. > instead > > Can someone help?? > Thanks > > > > Marcus Willemsen > Online Redaktion > Juve Verlag > Agrippastr. 10 > 50676 Köln > > > tel: ++49(0)221 91 38 80 16 > fax: ++49(0)221 91 38 80 18 > www.juve.de > [EMAIL PROTECTED] > [EMAIL PROTECTED]
What do you mean by "doesn't work"? I wrote this sample code and got the following output: <example> #!/usr/bin/perl -w use strict; my @dates = (1); my @themes; my @cities; do_something(\@dates, \@themes, \@cities); @themes = (shift @dates); do_something(\@dates, \@themes, \@cities); shift @themes; do_something(\@dates, \@themes, \@cities); sub do_something { my @dates = @{$_[0]}; my @themes = @{$_[1]}; my @cities = @{$_[2]}; if(@dates && !@themes && !@cities) { #do something with the data in @dates print "do something with the data in \@dates\n"; } elsif(!@dates && @themes && !@cities) { print "do something with the data in \@themes\n"; } else { print "do nothing\n"; } } </example> <output> do something with the data in @dates do something with the data in @themes do nothing </output> Which is exactly what I would expect. Perhaps you could post the original code you had problems with? -- Today is Boomtime the 14th day of Discord in the YOLD 3168 Missile Address: 33:48:3.521N 84:23:34.786W -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]