I have 3 arrays i.e. @sample1, @sample2 and @sample3 each with 4 elements. One
element in one array is linked to the corresponding position element in the other
two arrays. I mean to say that a, 1 & x1 are linked and so are the others. Now I want
to put all the arrays in a bigger array @big. At some point of time, I might be
interested to delete one element x3 from @sample3 and its corresponding values
from @sample1 and @sample2 i.e. c & 3 and likewise from array @big. The big array is
an array of arrays. I am at my wit's end to find out the resultant big array and other
three arrays after removing x3 & its corresponding values from @sample1 & @sample2.
I am looking forward to suggestions and guidance from PerlMonks in this matter.
my @sample1=qw/a b c d/;
my @sample2=qw/1 2 3 4 /;
my @sample3=qw/x1 x2 x3 x4/;
# Joined array:
my @big=(@sample1, @sample2, @sample3);
print"\n Original Big Array:\n
# To store the array values in a hash:
# Code for removing x3 & its corresponding values from big array???
# and code for modified @sample1, @sample2 & @sample3 ???
print"\n Original big array: @big\n
Resultant big array: @mod_big\n
Deleted Element: $deleted_ele\n
Modified sample1: @mod_sam1\n
Result should look something like:
Original big array: a b c d 1 2 3 4 x1 x2 x3 x4
Resultant big array: a b d 1 2 4 x1 x2 x4
Deleted Element: x3
Modified @sample1: a b d
@sample2: 1 2 4
@sample3: x1 x2 x4