Randy, The code is still not working with the modifications that you listed
earlier. The code does not have any compilation errors but does not
show the results for the variables $1, $2 and $3. I was wandering if
you could think of something else that is causing the problem.
#!C:\perl\bin\perl5.6.1
You forgot:
use strict; use warnings;
$file1 = ' C:\perl\bin\dummy.txt' ;
my $file1 = ' C:\perl\bin\dummy.txt' ;
open (INFO, "< $file1 ") or die "Can't open $file: $1";^^^^ ^^
Your die message uses a different variable ($file vs $file1). And you probably meant $! vs $1 to display the error message.
open (INFO, "< $file1 ") or die "Can't open $file1: $!";
while (<INFO>) {
if (/2\.2\.(\d+)\.(\d+)\.(\d+)/) {
print " $1,$2, $3 "; }}
close (INFO);
Despite the problems mentioned above, I'm not sure why it didn't work for you. Your code works as is for me with a dummy.txt file of, eg.
2.2.100.200.300
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>