Kenton Brede wrote:
>
> On Sat, Feb 07, 2004 at 02:08:26PM -0800, John W. Krahn ([EMAIL PROTECTED]) wrote:
>
> Thanks for your response. Where do I begin asking questions about this
> one, hehe.
>
> > sub get_uid {
> > my ( $start, $end ) = @_;
> > --$start;
> > defined getpwuid $start or return $start while ++$start <= $end;
> > return;
> > }
> >
> > print get_uid( 700, 799 ), "\n";
>
> I'll attempt to translate this into code.
>
> my $start = 700;
> my $end = 799;
> while(++$start <= $end) {
> if (defined(getpwuid($start)) {
> return $start;
> } else {
> return $start if ($start > --$start);
> }
>
> OK, I know that is probably way off. I'm having trouble wrapping my
> mind around this one.
It is more like:
my $start = 700;
my $end = 799;
--$start;
while ( ++$start <= $end ) {
unless ( defined( getpwuid( $start ) ) ) {
return $start;
}
}
return;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>