No. Not in perl 5. But you could do
foreach my $ref ( [ $name, $lastname ] ) { my( $x, $y ) = @$ref; # do something }
Whether that is applicable to your problem would require more context. Where do the values you which to index in pairs come from?
In reply to Re: can we pass two variable to foreach loop
by BrowserUk
in thread can we pass two variable to foreach loop
by phemal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |