in reply to Printing the comment

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:

#do a for loop to make it go through the test for ($i=0; $i<=#@Comment; $i++) { #Do an if loop to go through and save the right thing if ($value == $Comm[$i]) { $Como = $Comment[$i]; } }

When perl parses this, it interpretes it as:

for($i=0; $i <= if ($value==$Comm[$i]) { ....

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:

my $Como; foreach my $i (0..$#Comment) { $Como = $Comment[$i], last if $Comm[$i] == $value; } # ... and you should add error-checking: unless (defined $Como) { # do something here if we didn't find anything }

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):

# ... $Como = $Comment[$i], last if $Comm[$i] eq $value;

(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.