in reply to Re: Can this script be Optimized?
in thread Can this script be Optimized?
In the interest of education, map is a "feature enhanced" version of for.
map { expr; } @array; is equivalent to:
for (@array) { push @newarray, expr; }
Presumably, expr uses $_ either implicitly or explicitly.
Similarly, grep { expr; } @array; is equivalent to:
for (@array) { push @newaray, $_ if expr; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can this script be Optimized?
by kcott (Archbishop) on May 01, 2014 at 17:03 UTC | |
by RonW (Parson) on May 01, 2014 at 17:22 UTC | |
by kcott (Archbishop) on May 01, 2014 at 18:51 UTC |