On Sun, 2008-09-21 at 09:59 -0700, Ron Bergin wrote:
> 
> > #!/usr/bin/perl
> > #
> You're missing 2 very important pragmas that should be in every script
> you write.
> 
> use warnings; #
> use strict;   # forces you to declare your vars prior to their use.
> 
> > #
> > # Set behaviour
> > $log="/var/log/cisco.log";
> my $log = '/var/log/cisco.log';
> 
> > $ntop=10;
> my $ntop = 10;
> my (%quad, %port);
> 

my %quad = ();
my %port = ();

__END__

You should always set your variables to a known value.  perl will clear
them when it first starts, but other interpreters like mod_perl do not;
they re-use the data space as-is for efficiency.  You could end up with
data from the previous run.


-- 
Just my 0.00000002 million dollars worth,
  Shawn

"Where there's duct tape, there's hope."
        Cross Time Cafe

"Perl is the duct tape of the Internet."
        Hassan Schroeder, Sun's first webmaster

"There is more than one way to do things."
        A Perl axiom


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


Reply via email to