I was trying to build a new array based on an existing array.
#!/usr/bin/perl
#join
use warnings;
use strict;
my @names = ('jacob', 'michael', 'joshua', 'mathew');
my @t_names = join ("\t" , @names);
my @t_names2 = join ("\t", $names[0],$names[2]);
print @t_names, "\n";
print @t_names2, "\n";
The test script allows me to join 2 elements from the old array to form a new array. But what if my array has 1000 elements and I would like to form a new array that contains only a selective portion of the 1000 elements (say, element 3 and 3 multiples). I tried join ("\t", $names[0,2]) but perl doesn't recognize $names[0,2] (output suggests that $names[0,2] is "recognized" as $names[2]. And not sure what this error means "multidimensional syntax not supported at join.pl"
If join is not the right function, what other way could I build a partial array from an existing array? Thank you.