in reply to Last index use in array slice
TIMTOWTDI =)
(UPDATED code for clarification)
DB<123> $str =join '', a..h => "abcdefgh" DB<124> ( undef, undef, undef, undef , @rest) = split //, $str => ("a", "b", "c", "d", "e", "f", "g", "h") DB<125> @rest => ("e", "f", "g", "h")
with arbitrary index, we'll need a dummy array to swallow ignored entries:
DB<126> $index=4 => 4 DB<127> ( @ignore[1..$index] , @rest) = split //, $str => ("a", "b", "c", "d", "e", "f", "g", "h") DB<128> @rest => ("e", "f", "g", "h")
cause unfortunately this doesn't work:
DB<129> ( ( (undef) x $index ) , @rest) = split //, $str Can't modify repeat (x) in list assignment at (eval 65)[multi_perl5db. +pl:638] line 2, at EOF
Cheers Rolf
In Section
Seekers of Perl Wisdom