Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: problem with TK, tag, passing param with binding, destroying binds

by jsteng (Beadle)
on Apr 20, 2018 at 05:33 UTC ( [id://1213222]=note: print w/replies, xml ) Need Help??


in reply to Re^3: problem with TK, tag, passing param with binding, destroying binds
in thread problem with TK, tag, passing param with binding, destroying binds

I actually never used any perl style loops before other than foreach my $i ( ... );
and the working script I took that code indeed used foreach statement.

I got alot of recoding work to do, replacing all C style loops with a Perl style loop. Thanks for clarification.
  • Comment on Re^4: problem with TK, tag, passing param with binding, destroying binds

Replies are listed 'Best First'.
Re^5: problem with TK, tag, passing param with binding, destroying binds
by AnomalousMonk (Archbishop) on Apr 20, 2018 at 15:01 UTC
    ... replacing all C style loops ...

    I would urge you to approach this with caution. C-style loops have their uses, and it is not always advantageous or appropriate (or even possible) to replace such a loop with a Perl-style loop.

    I actually never used any perl style loops before other than foreach my $i ( ... );

    It's important to realize that the keywords for and foreach are exactly equivalent and completely interchangeable in any such statement. The different behaviors of the two different loop styles are entirely determined by whether the loop is written with an init/test/final block (C-style) or a list (Perl-style). Please see For Loops (which discusses C-style loops) and Foreach Loops (which discusses Perl-style loops), both in perlsyn. Again, regardless that the two different loop styles are discussed in sections clearly labeled "For" and "Foreach", respectively, the two keywords are completely interchangeable. (And then, of course, there's the statement modifier form!)


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-20 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found