use constant RETRIES => 3; for (1..RETRIES) { last if wrapper() }