missing last line

J

jammer

Is there a reason why this code would miss the last user?

@nameList = `cat '/etc/passwd'`;

foreach my $userName (@nameList) {
 
J

John W. Krahn

jammer said:
Is there a reason why this code would miss the last user?

@nameList = `cat '/etc/passwd'`;

foreach my $userName (@nameList) {

Try this and see if it works better:

setpwent;
while ( my @pw = getpwent ) {
print "@pw\n";
}
endpwent;


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,211
Messages
2,571,100
Members
47,695
Latest member
KayleneBee

Latest Threads

Top