in reply to extracting data from an input file and associated errors
open (DATA, "< C:/Perl_Scripts/InputFile.txt");
You should verify that open worked correctly:
open my $DATA, '<', 'C:/Perl_Scripts/InputFile.txt' or die "Cannot ope +n 'C:/Perl_Scripts/InputFile.txt' because: $!";
my @array_of_data = <DATA>; close (DATA); foreach my $line (@array_of_data) {
There is no need to read the entire file into memory first:
while ( my $line = <$DATA> ) {
if ( $line =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.csv$/g ) { print "Match $1"; }
The pattern is anchored at the end of the line so the /g option is superfluous. You are not using capturing parentheses in the pattern so there is nothing in $1 to print out.
|
|---|