On Mar 1, Jon Molin said:

>Jan Gruber wrote:
>> 
>> On Friday 01 March 2002 11:29 am, you wrote:
>> >
>> > 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?

The Perl documentation states, in perlsyn, that they are exactly the same
thing.  In Perl, there are many ways to do things.  Perhaps it makes more
sense to you to use 'foreach' when iterating over an array, and 'for' when
doing a C-style loop.

Personally, I always use 'for' because that's why I prefer.

tr/// and y/// are the exact same thing.  Preference.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to