On Monday 28 Feb 2005 18:34, John W. Krahn wrote:
> Gavin Henry wrote:
> > Hi all,
>
> Hello,
>
> > Just a quickie. I think the answer is that th while loop is going through
> > the file twice?
> >
> > --
> > Codes that does what I expect, i.e. prints out the 42 lines of my passwd
> > f
Gavin Henry wrote:
Hi all,
Hello,
Just a quickie. I think the answer is that th while loop is going through
the file twice?
--
Codes that does what I expect, i.e. prints out the 42 lines of my passwd
file, with the array spaces, due to the array in "", swapped for
and runs on $_:
#!/us
From: "Gavin Henry" <[EMAIL PROTECTED]>
> Just a quickie. I think the answer is that th while loop is going
> through the file twice?
Nope
> --
> Codes that does what I expect, i.e. prints out the 42 lines of my
> passwd file, with the array spaces, due to the array in "", swapped
>
--
Just getting into the best language ever...
Fancy a [EMAIL PROTECTED] Just ask!!!
>>
>>
>>I am not sure why? It misses the odd ones.
>>
>>while () {
>>my @passwds = split /:/, ;
>>
> You are reading the file twice in each while loop. Whenever you access
> , it returns a line and moves to the
I am not sure why? It misses the odd ones.
while () {
my @passwds = split /:/, ;
You are reading the file twice in each while loop. Whenever you access
, it returns a line and moves to the next line of the file.
So in "while () {" it returns one line of the passwd file .
As you are reading the l
Hi all,
Just a quickie. I think the answer is that th while loop is going through
the file twice?
--
Codes that does what I expect, i.e. prints out the 42 lines of my passwd
file, with the array spaces, due to the array in "", swapped for
and runs on $_:
#!/usr/bin/perl
use strict;