Walks the values 0, 1 and 2.my ( @a, @b ); @a = ( 1, 2, 3 ); foreach ( 0 .. $#a ) { }
does nothing. But $#b returns -1 because there are no values in it. If it would count down, It'd walk the values 0 and -1.foreach ( 0 .. $#b ) { }
In reply to Re: literal lists
by phaylon
in thread literal lists
by danmcb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |