in reply to How can you split inside pop?
In your first code piece, after the pop, you are left with @str containing "this", "is" and "a". The other piece of code doesn't have a @str. If all you care about is the last element of the split, there's no need for a pop at all:
That prints the last element of the list remaining after the split.print +(split /\s/ => $str) [-1];
Abigail
|
|---|