Syntactic Confectionery Delight | |
PerlMonks |
Re: Printing the commentby wog (Curate) |
on Oct 06, 2001 at 03:58 UTC ( [id://117145]=note: print w/replies, xml ) | Need Help?? |
Your problem is that you are commenting
out the latter part of your for loop and thus
the if statement is interpreted
as in the second part of the for loop, and a
syntax error. The offending code segment is:
When perl parses this, it interpretes it as:
Because the #@Comment ... starts a comment. You probably meant to use $#Comment instead. Alternately, it might be better to re-write that for loop to use the foreach-style:
update: but, you are trying to compare $value to string, so you should replace that == (which compares things as numbers) with an eq (which compares them as strings):
(Note that you could write that statement using the if (...) { ... } form, too, of course. You may find that clearer.) In the future it would be a good idea to use strict and warnings. And taint checks.
In Section
Seekers of Perl Wisdom
|
|