in reply to can we pass two variable to foreach loop
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can we pass two variable to foreach loop
by Anonymous Monk on Mar 22, 2011 at 05:18 UTC |