Will Muir wrote:
> I have an array of arrays @data that
> I would like to take the reference of the 5th element of the first 3 elements and
> put them into another array and then shorten @data by 3.
> I hope that this makes sense, I am new to this and
> don't really know a better way too explain it.
A good way to explain is always an example.
As I understand you, at the beginning is an array of array,
lets say
my @data = ([qw/a1 a2 a3 a4 a5 a6/],
[qw/b1 b2 b3 b4 b5 b6/],
[qw/c1 c2 c3 c4 c5 c6/],
[qw/d1 d2 d3 d4 d5 d6/],
[qw/e1 e2 e3 e4 e5 e6/]);
Following by your text,
you want to extract some informations:
my @extract = (a5, b5, c5);
and shorten @data:
my @data_shortend = ([qw/d1 d2 d3 d4 d5 d6/],
[qw/e1 e2 e3 e4 e5 e6/]);
Is it what you need ?!
If it is, the following snippet will do it:
my @extract = ($data[0]->[4], $data[1]->[4], $data[2]->[4]);
my @data_shortend = splice(@data, 3);
Greetings,
Andrea
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]