in reply to can we pass two variable to foreach loop
Only that it would be written as:foreach my ($x,$y) (@name,@lastname) { do something }
With each_array, you may create an iterator which is able to loop over more than one array at once. That easy.use List::MoreUtils qw(each_array); ... my $names = each_array(@name, @lastname); while ( my ($x, $y) = $names->() ) { do something }
|
|---|