Gerard Robin wrote:
On Sat, Sep 17, 2005 at 08:20:55PM +0530 Binish A R wrote:
Hello,
I've a doubt with getpwent function.
The following code [ getpwent in list context ] is getting into an infinite
loop:
............
#!/usr/bin/perl -l
while ($ref = [ getpwent() ]) {
last unless @$ref;
print $ref->[0];
}
Can someone explain for this behaviour of getpwent?
Has it got anything to do with the return value while invoking
getpwent in scalar and list context?
I am not an expert but this works fine for me:
#!/usr/bin/perl
#getpwent1.pl
while (@ref = getpwent()) {
foreach $i (0..8) {
print "$ref[$i] "
}
print "\n";
}
hth
well .. am trying to use references and its not working in some cases ... :(
--
/binish/
|
- Re: problems with getpwent Binish A R
-