Hi Perl Gurus,

This is a newbie question ofcourse. Since it is not working for me I am asking here.
I am trying to skip UID above 60000.

$passwd = "/etc/passwd";
$skip = 60000;
open(PW,$passwd) or die "Can't open $passwd:$!\n";
while (<PW>){
    @fields = split(/:/);
    next if $fields[2] > $skip;
    $highestuid = ($highestuid < $fields[2]) ? $fields[2] : $highestuid;
}
close(PW);
print "The next available UID is " . ++$highestuid . "\n";

Thanks for any suggestion.


Anidil Rajendran
Redwood Shores,CA
650 730 8271


Reply via email to