I first tried to teach myself to program using Perl. It ha(s|d) the most complete documentation with an expansive library of books and tutorials. I learned a lot about learning to program and asking good questions because of Perl.
On a Monday, I was asked if I knew Perl. I replied that I knew several languages it was based on (awk, sed, Bash) but not Perl exactly. They said "Cool. Your interview is this Thursday. Know Perl by then."
I spent three days on perldoc.perl.org to ace that interview, and found the documentation to be equal parts blunt, refreshing, informative, and horrifying.
Case in point: "If any part of LIST is an array, foreach will get very confused if you add or remove elements within the loop body, for example with splice. So don't do that."
It's common knowledge that modifying the list you're iterating over is a bad idea in almost any language. Safe languages have ways to detect this situation and prevent errors (like Java's ConcurrentModificationException). Unsafe languages trust you to know better. Perl... helpfully tells you not to do that.
I've certainly pushed onto the tail end of a looping array in Perl. You just need to be careful.
But I don't do it anymore.
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.