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
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!
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!
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
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