Kevin Old wrote:
>
> On Thu, 2003-11-13 at 09:33, Rob Dixon wrote:
> > "Bob Showalter" <[EMAIL PROTECTED]> wrote in message
> > >
> > > Christiane Nerz wrote:
> > > > Kevin Old wrote:
> > > > ...
> > > > > select undef, undef, undef, 0.25 or print $_
> > > > >   for 1 .. 5;
> > > > ...
> > > > quite interesting chunk of code - but what the hell does select does
> > > > here? Yeah - I rtfm - but didn't understand it - maybe one could
> > > > explain it in more simple words?
> > >
> > > It's used in this case for sleeping for less than one second. The sleep()
> > > function only sleeps for a whole number of seconds.
> >
> > Not exactly a transparent piece of code though is it. Especially
> > if your base system isn't Unix!
>
> Yes, I agree, but technically it's not my code snippet.  From whoever I
> learned the autoflushing technique from, they gave me this code
> snippet.  Yeah, I was confused about the select statement, but the
> perldoc on select does have that same snippet for delaying 1/4 second.

Don't worry Kevin, I wasn't getting at you! Your example is
indeed straight from

  perldoc -f select

but I was trying to say that it was so obscure it ought
to be wrapped within a subroutine, something like

  # Do a high-resolution sleep using 'select'
  #
  sub sleep_hires {
    select(undef, undef, undef, shift);
  }

Cheers,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to