Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Dynamic if loop

by CountZero (Bishop)
on Mar 25, 2010 at 07:23 UTC ( #830764=note: print w/replies, xml ) Need Help??

in reply to Dynamic if statement

What have you tried?

What do you mean by an if-loop?

Perl has for or foreach-loops, while and until loops. They can be further modified with next, last, redo and continue operators.

There are a number of hidden loop constructs such as map and grep.

Finally you can "roll your own" with labels, if ... then ... else and goto

Plenty of choice: it is the embarrassment of riches.


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Dynamic if loop
by merlyn (Sage) on Mar 25, 2010 at 16:36 UTC
    Maybe if-loop is the new name for the FOR-CASE paradigm. :)

    -- Randal L. Schwartz, Perl hacker

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://830764]
[Corion]: GotToBTru: Yeah, I started a quick(ly implemented but slowly running) implementation of a program that would guess the "best" configuration (that is, least amount of changes) from my code, but then found that it stops parsing the source as soon as it ..
[GotToBTru]: sadly, it can't do anything about this
[Corion]: ... encounters sub foo($bar,$baz) {, which is something I like nowadays
[Corion]: GotToBTru: Yeah, that stuff is hard to do away automatically ;)
[GotToBTru]: yeah, you mentioned it could not handle signatures
[Corion]: And so far I like signatures and nobody has yet come up to me and screamed at me for implementing a source filter to handle them even on early Perl versions ;)

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2017-02-27 14:38 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (387 votes). Check out past polls.