in reply to Starting foreach at an arbitrary position
Unfortunately you have to use $#array (I'd like if I could write things like @array[2:] but after all this is syntactic sugar). Note that you can't write 2 .. -1 to mean from the element with index 2 to the last one.my @array = qw/the that which who when if this/; foreach( @array[2 .. $#array] ) { $_ = uc $_; # $_ is an _alias_ } print "@array\n";
|
|---|