Your 2 examples have slightly different logic. In your first example (with the database) you are pushing and printing inside the loop. In your second example you are pushing inside the loop but printing outside it. This explains the difference in the outputs you are seeing.
🦛
In reply to Re: How can I get the last element of an array inside of fetchall_arrayref?
by hippo
in thread How can I get the last element of an array inside of fetchall_arrayref?
by Lewisa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |