in reply to Vector manipulation
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Vector manipulation (scalar)
by jcklasseter (Sexton) on Jun 29, 2015 at 12:02 UTC |