Re: open files in a directory

2011-08-01 Thread Shlomi Fish
Hi John, a few comments on your code (some of which was derived from the OP's). On Mon, 01 Aug 2011 00:26:29 -0700 "John W. Krahn" wrote: > homedw wrote: > > hi all, > > Hello, > > > > i want to open some files in a directory, you can see the details below, > > > > #!/usr/bin/perl -w > > use

Re: open files in a directory

2011-08-01 Thread timothy adigun
Hi Jack, Your code should work fine except for d following: 1. your $sum used in the while loop is out of scope i.e declare it before your first for loop, and intialize to zero. As u have it in your code. The last print statement will print nothing 'cos $sum is out of reach, so u see nonthing!

Re: open files in a directory

2011-08-01 Thread timothy adigun
Hi Jack, Your code should work fine except for d following: 1. your $sum used in the while loop is out of scope i.e declare it before your first for loop, and intialize to zero. As u have it in your code. The last print statement will print nothing 'cos $sum is out of reach, so u see nonthing!

Re: open files in a directory

2011-08-01 Thread Emeka
I guess that $sum should be "my $sum" before using it. Emeka On Mon, Aug 1, 2011 at 8:26 AM, John W. Krahn wrote: > homedw wrote: > >> hi all, >> > > Hello, > > > > i want to open some tha files in a directory, you can see the details >> below, >> >> #!/usr/bin/perl -w >> use strict; >> opendi

Re: open files in a directory

2011-08-01 Thread John W. Krahn
homedw wrote: hi all, Hello, i want to open some files in a directory, you can see the details below, #!/usr/bin/perl -w use strict; opendir (FH,'C:\Player'); chdir 'C:\Player'; for my $file(readdir FH) { open DH,"$file"; foreach my $line() { whil