in reply to extract words from specific location
Why not use a for loop like so:
Update:use warnings; use strict; my @alpha = qw(a b c d e f); my @location = qw(0 2 4); print $alpha[$_+1] for @location; # prints bdf
my @alpha = qw(a b c d e f); my @location = qw(0 2 4 6 8 10 12); for (@location){ print $alpha[$_+1] if defined $alpha[$_+1]; }
|
|---|