[EMAIL PROTECTED] wrote: > Mr. Shawn H. Corey wrote: > > [EMAIL PROTECTED] wrote: > > > Morning All, > > > > > > I've a relatively minor problem that has been giving me a headache for > > > several days. I know there are many other ways to do this, however I'd > > > like to know why this isn't working. The snippet of code in question > > > is as follows > > > > > > <snip> > > > if($ARGV[2] =~ /port/i && $ARGV[3] =~ /nick/i) > > > { > > > <snip> > > > > > > > And what is your command line? > > > > > > -- > > Just my 0.00000002 million dollars worth, > > Shawn > > > > "For the things we have to learn before we can do them, we learn by doing > > them." > > Aristotle > > I ought clarify. > > It's not a problem with the command line, or anything like that, it's > a problem with if/conditional statement Perl simply wouldn't compile/ > run the script. Take for example this alternative: - > > hopesprings# cat > test.pl > #!/usr/bin/perl -w > > $test = "cheese"; > $test_two = "ontoast"; > > if($test =~ /^che/i) > { > print "$test contains che\n"; > } > if($test =~ /che/i || $test_two =~ /toast/i) > { > print "Test two contains toast and test contains che\n"); > } > > hopesprings# ./test.pl > syntax error at ./test.pl line 12, near ""Test two contains toast and > test contains che\n")" > Execution of ./test.pl aborted due to compilation errors.
That was moronic of me, using or instead of and. However, that's another problem I was having. I have tried permutations of ||, && and now AND. i.e. if($test =~ /che/i && $test_two =~ /toast/i) if($test =~ /che/i || $test_two =~ /toast/i) if($test =~ /che/i AND $test_two =~ /toast/i) None work. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/