Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548 https://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 20 bytes, whereas the latter takes up 39. However, the former requires you aren't using $u and have never defined it.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, using select($u,$u,$u,0.1) saves 19 bytes, which is definitely an improvement in most cases.

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 20 bytes, whereas the latter takes up 39. However, the former requires you aren't using $u and have never defined it.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, using select($u,$u,$u,0.1) saves 19 bytes, which is definitely an improvement in most cases.

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from https://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 20 bytes, whereas the latter takes up 39. However, the former requires you aren't using $u and have never defined it.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, using select($u,$u,$u,0.1) saves 19 bytes, which is definitely an improvement in most cases.

added 90 characters in body
Source Link

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

$u=undef;selectselect($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 2920 bytes, whereas the latter takes up 39. However, the former requires you aren't using $u and have never defined it.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, defining $u to undef and using select($u,$u,$u,0.1) saves 1019 bytes, which is definitely an improvement in most cases.

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

$u=undef;select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 29 bytes, whereas the latter takes up 39.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, defining $u to undef and using select($u,$u,$u,0.1) saves 10 bytes.

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 20 bytes, whereas the latter takes up 39. However, the former requires you aren't using $u and have never defined it.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, using select($u,$u,$u,0.1) saves 19 bytes, which is definitely an improvement in most cases.

Source Link

Use select(undef,undef,undef,$timeout) instead of Time::HiRes

(Taken from http://stackoverflow.com/a/896928/4739548)

Many challenges require you to sleep with greater precision than integers. select()'s timeout argument can do just that.

$u=undef;select($u,$u,$u,0.1)

is much more efficient than:

import Time::HiRes qw(sleep);sleep(0.1)

The former is only 29 bytes, whereas the latter takes up 39.

If you're going to use it a lot importing Time::HiRes pays off, but if you only need it once, defining $u to undef and using select($u,$u,$u,0.1) saves 10 bytes.

AltStyle によって変換されたページ (->オリジナル) /