This will save you a world of hurt:

use strict;

and test your scripts with

perl -cw scriptname.pl

This tests your scripts for syntax errors - great for debugging!!  If you
are calling modules from a directory outside of the normal perl @INC:

perl -cwI /weirdDirectory scriptname.pl


It took me months of Perling before finding that one out.  It has saved me
lots 'O time and hairpulling!  ;-)



"Mark Vanmiddlesworth" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> this is a script that systematically pings every host on the network,
> and writes the output to the screen. If the -n arg is specified, it
> will also write to a disk. What's wrong with the syntax, especially
> line 12?
>
> #!/usr/bin/env perl
>
>
> $x = 1;
> $b = 0;
>          for ($x = 1; $x < 256; $x++) {
>                  $a = `ping -q -c 1  192.168.1.$b`;
>                  $b += 1;
>                  print "192.168.1.$b   ";
>                  print $a;
>                  $usage="ping.pl [-n]"
>                  if ($arg = "-n") {$e = 0}
>                  else {$e = 1}
>                  if ($e = 1) {
>                          open (LOG, ">>/perl/pinglog.txt";
>                          print `date`;
>                          print $a;
>                          }
>                  else {}
>                  }
>
>
>
> Am I doing my ifs correctly? Thanks,
> mark
> got root?
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to