my $file = $ARGV(0);
hmmm -- try
my $file = shift;
----- Original Message -----
From: "Brett W. McCoy" <[EMAIL PROTECTED]>
To: "Susan Richter" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, May 05, 2001 1:26 AM
Subject: Re: Counting lines on a file
> On Fri, 4 May 2001, Susan Richter wrote:
>
> > Can someone tell me what command I can use to go to machines and count
the
> > lines on a certain file? I have log files for every machines (20 all
> > together). Each log file has lines that would equate to the files that
it
> > found. I need to know how many files are found on all the machines. I
am
> > using Perl 5 on NT.
>
> Here's a code snippet to do it:
>
> my $file = $ARGV(0);
>
> open(FILE, "<$file") or die "Could not open $file: $!\n";
> my $counter = 0;
>
> while(<FILE>) { $counter++; }
>
> close(FILE);
>
> print "$counter\n";
>
> -- Brett
> http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> Shhh... be vewy, vewy, quiet! I'm hunting wabbits...
>