I am not sure what's causing the "Global symbol" error, but it's not in the code you've shown. The syntax error is because you forgot a curly bracket to end the if block.
There is also a logic error, though. You are using eq to check for string equality, but this checks if one string matches another string exactly. So "hi" and "hi " would not match with eq.
You probably want a pattern match, instead. This is covered nicely in perlretut, but here's a very quick example:
foreach my $str ("one", "two", "three") { if ($str =~ /^t/) { print "'$str' starts with 't'\n"; } else { print "'$str' does not start with 't'\n"; } }
In reply to Re^5: Looking to confirm a file against CVS as part of a loop
by revdiablo
in thread Looking to confirm a file against CVS as part of a loop
by Seventh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |