Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: last in a do while loop

by Hofmator (Curate)
on Nov 03, 2006 at 13:39 UTC ( #582081=note: print w/ replies, xml ) Need Help??


in reply to Re: last in a do while loop
in thread last in a do while loop

Mmhh, I know this is just copy and pasted code, but it makes me wonder anyway - is it just me or is the code for the last example slightly strange?

LOOP: { do { last if $x = $y**2; # do something here } while $x++ <= $z; }
  • if $x = $y**2; why choose a confusing assignment instead of a normal comparison?
  • Why not the explicit last LOOP? I know that it works here without it all right but I don't see the benefit of labelling the block without using the label afterwards

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


Comment on Re^2: last in a do while loop
Select or Download Code
Re^3: last in a do while loop
by davorg (Chancellor) on Nov 03, 2006 at 13:48 UTC

    I was thinking exactly the same things as I was writing the post. I foresee a couple of patches being sent to the maintainers.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://582081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2014-07-10 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (202 votes), past polls