I'm using Windows Subsystem for Linux Perl and I'm getting weird results when printing an array
while (scalar @list_words) { test_if_letters_are_included(); foreach(@list_words) { print "$_\n"; } my @array = qw(this that the other thing); say "@array"; say "@list_words"; say scalar @list_words; }
I truncated the output for brevity. Prints:
...ZONDA ZONED ZONES ZOOID ZOOKS ZOOMS ZOONS ZORIS ZOSMA ZUDDA ZULUS ZUNIS this that the other thing ZUNIS 8471
Any guesses as why I would only get the last element of the @list_words array?
Even weirder yet. If I change "say" to "print" on the @array I get an output that is a mix of both arrays!
while (scalar @list_words) { test_if_letters_are_included(); foreach(@list_words) { print "$_\n"; } my @array = qw(this that the other thing); print "@array"; say "@list_words"; say scalar @list_words; }
Again, I truncated the output for brevity. Prints:
...ZONDA ZONED ZONES ZOOID ZOOKS ZOOMS ZOONS ZORIS ZOSMA ZUDDA ZULUS ZUNIS this that the other thing ZUNIShat the other thingABASE 8471
"ABASE" is the index 14 of @list_words.
In reply to Bizarre Perl behavior? by Polymathic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |