Hello Derek,

When using strict, the error message should point you to the line where the
error is. It's usually pretty darn good at pointing the right line. In this
case, I bet it's this one:

>        while ( defined($line = <CRITICALSERVERS>) ) {

There is no declaration of the $line variable. Try declaring it first, like
this:

        my $line;
        while ( defined($line = <CRITICALSERVERS>) ) {

I think that's the only variable that wasn't declared. If you get any more
error messages, you can check them out and figure out what's wrong.

Just a suggestion: You should use or instead of || when checking if a file
opened correctly, because if you ever want to do some operations on the
right side, or will bind less tightly and allow your operations to work
correctly without needing parentheses to fix the precedence.

By the way, why are you reading one line in the while's parentheses, and and
then slurping the rest of the file into an array inside the while? That
means your while will only be run once, because at the next iteration you'll
already be at the end of the file... Just use $line inside the while, and
you'll read one line at a time. 

You also chomped your line, which is good. Just remember to re-add the line
ending ("\n") when printing the lines as you're doing, or else all the lines
will be printed on a single, very long line.

I'll let the experts explain what soft references and barewords are. I've
never used either, as I come from the relatively new school of programming.
As I understand, they are features of the language that are dangerous to use
in some contexts, so use strict disallows them knowing that if you really
want to use them, you'll disable strict for the block of code where you use
it, and then re-enable it.

Hope this helps,


Jean-Sébastien Guay

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


Reply via email to