#!/usr/bin/perl use strict; use warnings; use 5.012; # 918508 wants linknames from para 2 only my @data = ('
', 'Link1', 'Link2', 'Link3', '
', '', 'Link4', 'Link5', 'Link6', '
',); my (@linkName, $linkName); my $flag = 0; for my $data(@data) { chomp $data; if ( $data =~ // ) { # when the above is true, we've found para 2 $flag = 1; } if ( $flag && ($data !~ /
/) ) {
# now, we want to skip the data --the para heading --
# the first time we arrive here, but if it's not the heading,
# then capture the link title
if ( $data =~ m/(Link\d)<.+/ ) {
$linkName = $1;
push @linkName, $linkName;
}
}
}
for my $extracted(@linkName) {
say $extracted;
}
####
Link4
Link5
Link6