Lazy evaluation?



In a statement like this:

local $\ = "\n";
foreach $num (1..1000_000_000) {
print $num;
}

or this:

local $\ = "\n";
foreach $line (<$handle>) {
chomp $line;
print $line;
}

does Perl use lazy evaluation? Thanks!
.



Relevant Pages

  • Re: Lazy evaluation?
    ... foreach $num { ... really sure if up to the point of lazy evaluation. ... The above (foreach list) *is* lazy evaluated (at least ... actually required for the printfunction which is not what perl does. ...
    (comp.lang.perl.misc)
  • Re: Lazy evaluation?
    ... foreach $num { ... does Perl use lazy evaluation? ...
    (comp.lang.perl.misc)
  • Re: Bidirectional mapping
    ... SAT SUN]? ... For quick and dirty and highly readable I usually do it like: ... foreach { ... set day_num($day) $num ...
    (comp.lang.tcl)
  • Re: Lazy evaluation?
    ... Michele Dondi wrote: ... foreach $num { ... really sure if up to the point of lazy evaluation. ...
    (comp.lang.perl.misc)
  • parse hash by array element seems to run slow
    ... I've been through the faq's and every web site that focuses on perl ... I iterate the array and search the hash keys to find a match and then ... foreach $verifyArr ...
    (comp.lang.perl.misc)