On Aug 10, 8:28 am, [EMAIL PROTECTED] wrote:
> I ought clarify.

No, you ought to post a short-but-complete script to start with, and
not assume you know what one specific line of the program is causing
problems.

> It's not a problem with the command line, or anything like that, it's
> a problem with if/conditional statement

No it's not.  If you knew what the problem was, you wouldn't be
posting here.  Stop assuming.

> Perl simply wouldn't compile/run the script.

Then say that next time.  Don't say "didn't work", which could mean
anything.

> 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");

This line has a closing parenthesis but no opening parenthesis.
That's a syntax error.

> }
>
> hopesprings# ./test.pl
> syntax error at ./test.pl line 12, near ""Test two contains toast and
> test contains che\n")"

... and Perl rightly tells you there's a syntax error, and even on
what line.  What about this error made you assume there was something
wrong with the if statement or the regexp syntax?

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to