@foo = ("foo1", "foo2");
@bar = ("bar1", "bar2");
for ( \@foo, \@bar ) {
print "$_->[0] : $_->[1]\n";
}
will output
foo1 : foo2
bar1 : bar2
I was thinking more of iterating through them at the same time, which would
sort of like compare them. I believe this was the initial topic of this
thread (I believe, that was about two days ago, my mind might be going blank
though).
So my initial code (which I modified a little...)
for ( @foo, @bar ) {
print "$_[0] : $_[1]\n";
}
for would set each element of the @_ array to correspond to the arguments in
for() , therfore $_[0] will equal to the current element of @foo and $_[1]
will equal to the corresponding element of @bar. As I mentioned before this
can very easily be accomplished through 0..$#foo loop, but people disagreed
based on that it would be a nice option, in my opinion it's useless, but if
was implemented this could be a way:)
Ilya
-----Original Message-----
From: 'John Porter '
To: [EMAIL PROTECTED]
Sent: 07/19/2001 1:46 PM
Subject: Re: what's with 'with'? (was: [aliasing - was:[nice2haveit]])
Sterin, Ilya wrote:
> Well then maybe $_ can be a reference to a multidimensional array or
hash,
> and temp vars can be access like this.
>
> for ( @foo, @bar ) {
> print "$_->[0] : $_->[1]\n";
> }
That's bizarre and unnecessary. We can already do this:
for ( \@foo, \@bar ) {
print "$_->[0] : $_->[1]\n";
}
--
John Porter