Randy, I tried the following code as you mentioned but still seem to be failing to do any print on the screen. The code is as follows:
use strict; use warnings; # > $file1 = ' C:\perl\bin\dummy.txt' ; my $file1 = ' C:\perl\bin\dummy.txt' ; #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); Regards, SUnny -----Original Message----- From: Randy W. Sims [mailto:[EMAIL PROTECTED] Sent: Monday, August 09, 2004 5:27 PM To: Singh, Harjit Cc: [EMAIL PROTECTED] Subject: Re: Trying To write a script Singh, Harjit wrote: > 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> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>