I think its better written without the @ symbol when dereferencing the array reference and getting the number of the last index of the array using $#:
- use strict;
-
use warnings;
-
my $nscans = [1,2];#<-- $nscans is a reference to an array
-
if( $#{$nscans} > -1 ){
-
print "true";
-
}
The above code prints "true" when run with strict turned on. So I think the problem is elsewhere in your code. Are you sure $nscans is a reference to an array? Add this to your code and see what it prints:
If $nscans is an array it should print ARRAY.