my $vect1 = $val1->[3..5];. When I print test here, I get: 2
Yep. 3..5 is being evaluated in scalar context because dereferencing to get a scalar wants a scalar index:
% say "[0..9]->[4,5]" Useless use of a constant (4) in void context at (eval 1) line 1. 5
You probably want:
my $vect1 = [ @{ $val1 }[3..5] ];
- tye
In reply to Re: Vector manipulation (scalar)
by tye
in thread Vector manipulation
by jcklasseter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |