Answer:
see explaination
Explanation:
use strict;
use warnings;
my $filename = 'data.txt';
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
while (my $row = <$fh>) { //Q1
chomp $row;
atfields = split(/:/, $row);
if($fields[7] eq "?" || $fields[7] eq NULL)
print "$row\n";
}
while (my $row = <$fh>) { //Q2
chomp $row;
atfields = split(/:/, $row);
print '$fields: ' , replace($fields[1],"",$fields[1]) , "\n";}
}
while (my $row = <$fh>) { //Q3
chomp $row;
atfields = split(/:/, $row);
if (index($fields[2], "-") != -1) { //Looking out for negative sign in the field
print "$row\n";
}
while (my $row = <$fh>) { //Q4
chomp $row;
atfields = split(/:/, $row);
if($fields[7] eq "Voyager2")
print "$row\n";
}
Note: replace at anywhere in the program with the at symbol