in reply to Understanding split in a while loop
while (<PASSWD>) { my @passwds = split /:/, <PASSWD>; }
Note that you've used <PASSWD> twice. This will skip the even-numbered lines of the file, not the odd-numbered. This is because you read a second line from the file each time inside the loop, splitting on that value. Therefore, your first line that is read from the file (read into $_ in the while() loop) is more or less being discarded.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Understanding split in a while loop
by ghenry (Vicar) on Feb 28, 2005 at 12:50 UTC | |
by Fletch (Bishop) on Feb 28, 2005 at 13:54 UTC |