in reply to Re^4: Perl's feature to determine, in current point of loop, that this is the last one?
in thread Perl's feature to determine, in current point of loop, that this is the last one?
> It's so easy to avoid the limitation.
unfortunately no, but good idea nonetheless ... :)
DB<39> x @input 0 2 1 7 2 11 3 15 DB<40> use experimental 'refaliasing'; \$input[1] = \$input[-1] DB<41> x @input 0 2 1 15 2 11 3 15 DB<42> for my $v (@input) { say $v if \$v==\$input[-1] } 15 15 DB<43>
I'm not even sure that experimental feature is even needed...
IIRC one could somehow use typeglob aliasing on array elements.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Perl's feature to determine, in current point of loop, that this is the last one?
by ikegami (Patriarch) on Jan 25, 2022 at 14:46 UTC |
In Section
Seekers of Perl Wisdom