rakshas has asked for the wisdom of the Perl Monks concerning the following question:
As I have said earlier, I want to extract "120.115.152.136", hence I am using the regex. It just prints "Match" but also gives an error Use of uninitialized value $_ in pattern match (m//) at C:\Perl_Scripts\Compare.pl line 31. Any Help will be much appreciated. Regards Vivekuse strict; use warnings; print "\nEnter the Model 1\n"; my $Model_Name1= <STDIN>; chomp $Model_Name1; open (DATA, "< C:/Perl_Scripts/InputFile.txt"); my @array_of_data = <DATA>; close (DATA); foreach my $line (@array_of_data) { if ( $line =~ m/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\.csv$/g ) { print "Match $1"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: extracting data from an input file and associated errors
by jwkrahn (Abbot) on Feb 02, 2012 at 23:47 UTC | |
|
Re: extracting data from an input file and associated errors
by chilledham (Friar) on Feb 02, 2012 at 23:42 UTC |