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.
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: <%-{-{-{-<
| [reply] [d/l] [select] |
|