Jon Molin wrote:
>
> Jan Gruber wrote:
> >
> > Hi, Jon && list !
> > On Friday 01 March 2002 11:29 am, you wrote:
> > > Hi list!
> > >
> > > I've always thought there's a difference between for and foreach, that
> > > for uses copies and foreach not. But there's no diff is there?
> >
> > AFAIK there's not really a difference between these two.
> >
> > It merely depends on your preferences, readable/maintanable code vs
> > quick && dirty.
>
> if there's no difference, what's the point of having both? I can't see
> how readable/maintanable would increase by adding functions with the
> same name, it'd rather increase the confusion...
>
> is there really no diff?
FWIW Perl1 didn't have foreach, it was added in Perl2. From the Perl2
Changes file:
New iterator for normal arrays, foreach, that allows both read and
write:
foreach $elem ($array) {
$elem =~ s/foo/bar/;
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]