To expand on what flexvault said: you're using @SPECores as both a lexical and a global variable. The lexical declaration (my @SPECores) in your if() { ... } block shadows the global variable, so you're writing to the lexical variable, but when it goes out of scope at the end of the block, the global variable becomes visible again, and that's what you print.
use strict; might've given you a clue here, BTW:
Global symbol "@SPECores" requires explicit package name at 1098850.pl + line 17. Execution of 1098850.pl aborted due to compilation errors.
Always use strict. It's your friend, and will catch many mistakes and potential sources of headaches for you.
In reply to Re: Array is empty when using if else condition
by AppleFritter
in thread Array is empty when using if else condition
by kaka_2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |