[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] "," instead of ";" in "for"



On Fri, 27 Aug 1999 22:20:57 +1000, Peta Adams - John Murray wrote:

>print 'The names of lists we currently support are:',"\n";
>	for ($i = 0, $i < @lists, $i++) {
# The line above contains the changes
>	print $i;
>	print $lists[$i],"\n";
>}
>OUTPUT:
>The names of lists we currently support are:
>1arrangements
>1arrangements
>1arrangements

You have a variation on the theme:

	@array = ($i = 0, $i < @lists, $i++);
	# 3 items
	# $i now is 1, because of the "$i++"
	for(@array) { # 3 times
		# $i doesn't change: always 1
		print $i;
		print $lists[$i],"\n";
	}

	Bart.

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org