J
J Krugman
With map, one can streamline for-loops like this one:
my @array_2;
push @array_2, some_sub($_) for @array_1;
into a single assignment:
my @array_2 = map some_sub($_), @array_1;
Is there a way (not necessarily using map) to streamline while-loops
like this one:
my @array;
push @array, some_other_sub() while some_condition();
into a single assignment to @array?
TIA!
jill
my @array_2;
push @array_2, some_sub($_) for @array_1;
into a single assignment:
my @array_2 = map some_sub($_), @array_1;
Is there a way (not necessarily using map) to streamline while-loops
like this one:
my @array;
push @array, some_other_sub() while some_condition();
into a single assignment to @array?
TIA!
jill