473,387 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Perl loops should use break, not last

Probably been mentioned before but I fail to see why Perl changed the
'break' keyword to 'last', in loops. Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,
but not that the execution should be stopped immediately, whereas break
makes it sound like the latter.

Where can I propose that this be changed, or break aliased to last, for Perl
Best regards,
Jeremy Morton (Jez)
Jul 19 '05 #1
1 120117
Jeremy Morton wrote:
Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,

The semantics of 'break' or 'last' are defined by the language (in this
case Perl), not by you.

Why not think of 'last' as "this is the last statement to run for the

It's always struck me as odd that the 'continue' statement in 'C'
starts the next pass of a loop. This is definitely a strange use of the
concept of "continue". But it is the semantics of 'C', so I accept it.
By trying to map particular programming concepts into single English words
with exisiting meaning there is always going to be some sort of mismatching
Just because I've written it doesn't mean that
either you or I have to believe it.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Oleg Leschov | last post by:
Could there be means of exiting nested loops in python? something similar to labelled loops in perl.. I consider it irrating to have to make a flag for sole purpose of checking it after loop if...
by: Reinhold Birkenfeld | last post by:
Hello, another Perl/Python question: the subject says it all. Perl is going to change dramatically to become a more powerful and easier to (read|write) language. Is Python taking a similar...
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
by: bobmct | last post by:
In a multiple nested structure I have a section that when true need to break out of not only the current structure, but several more to read a much higher level. In perl I would name/label my...
by: Wijaya Edward | last post by:
Can we make loops control in Python? What I mean is that whether we can control which loops to exit/skip at the given scope. For example in Perl we can do something like: OUT: foreach my $s1...
by: eight02645999 | last post by:
hi, how can i skip printing the last line using loops (for /while) eg for line in open("file): print line. I want to skip printing last line of the file.thanks
by: hakiran | last post by:
Hello all, I have been using Perl DBI the last 6months or so. I use it extensively with MySQL. But recently i tried to access Oracle DB with it and was having trouble. Any help would be...
by: crystal2005 | last post by:
Hello guys.... I'm newbie in Perl Language. So, in here i would like to ask several questions about Perl itself and not about the coding. I have been given a task to use Perl for directory...
by: Smokeho | last post by:
I've been searching for an answer to this for a long time, but found absolutely nothing. Obviously some AJAX has to be used, possibly setting some session variables, but everything I've tried has...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.