You could use a regex, but as you see, that can get clumsy (it need not be quite this clumsy; this is babytalk for clarity). Also, it assumes that each line of data you show is actually "an element of an array" as stated, and is NOT itself an array from an AoA:
#!/usr/bin/perl
use 5.016;
use warnings;
use strict;
use Data::Dumper;
# 1021730
my @arr = ("ATOM 1276 CB ASP B 63 52.957 58.788 67.683 1.00 44.59 C",
"ATOM 1280 N GLY B 64 52.075 55.496 66.522 1.00 35.29 N",
"ATOM 1281 CA GLY B 64 51.005 54.534 66.322 1.00 32.64 C",
"ATOM 1282 C GLY B 64 49.693 55.103 65.854 1.00 30.87 C",
"ATOM 1283 O GLY B 64 48.630 54.545 66.092 1.00 27.93 O",
"ATOM 1284 N LYS B 65 49.739 56.255 65.189 1.00 31.10 N",
"ATOM 1285 CA LYS B 65 48.527 56.912 64.720 1.00 33.91 C",
"ATOM 1286 C LYS B 65 48.629 57.147 63.216 1.00 32.04 C",
"ATOM 1287 O LYS B 65 49.675 57.571 62.721 1.00 31.87 O"
#Col1 2 3 4 5 6 7 8 9 10 11 12
);
# So, let's say columns 3, 6, 7, 10 and 11 are the ones you want to se
+lect:
my ($selected, @selections);
for my $line(@arr) {
if ( $line =~ /ATOM\s # leading "ATOM" followed by a space --
+e.g. Column 1
\d{4}\s # 4 decimal digits followed by a space (
+FBAS)
([A-Z]{1,2})\s # CAPTURE to $1: One or Two UC letters F
+BAS from Col 3
[A-Z]{3}\s # Three UC letters
B\s # "B" -- constant in example data at Col
+ 5
(\d\d)\s # CAPTURE TO $2 exactly 2 digits from Co
+l 6
(\d+\.\d+)\s # CAPTURE to $3: digit(s), decimal pt, d
+igit(s) Col 7
\d+\.\d+\s # 1 or more digits, decimal pt, digits C
+ol 8:
\d+\.\d+\s # Col 9
\d+\.\d+\s # Col 10
(\d\d\.\d\d)\s # CAPTURE to $4 exactly 2 digits, decima
+l, 2 digits Col 11
([CNO]$)/x ) # CAPTURE TO $5: one UC "C", "N", or "O"
+ adjacent to EOL
{
$selected = $1 . " | " . $2 . " | " . $3 . " | " . $4. "
+| " . $5;
say $selected; # for DEMO and DEBUG only
push @selections, $selected;
}
# .... and do whatever sleight-of-hand you need with @selections
+...
}
say Dumper @selections;