in reply to Looper

I am assuming $ref[2] is what is meant by, if
$b = @ref; if ($b < 2) { ... }
If you mean to stop it when $b == 3 (as that is when $ref[2] exists). Why not just stop looping at this point using last. Like so:
last if $b == 3;
As soon as this is evaluates as true, it will break out of the loop, which in this case is the while loop. If this is not what you wanted could you be a little more descriptive as to what it is that you want to accomplish (I am mainly guessing with my response).

-enlil

Replies are listed 'Best First'.
Re^2: Looper
by tadman (Prior) on Nov 24, 2002 at 04:21 UTC
    Why not ditch the intermediate and cut to the chase:
    last if (@ref > 2);  # More than two elements
    Update: Make that @ref instead of @b