Hello,

You can simply say 

while (<IN>){
        if ($_ =~ /NSTEP/){
                print OUT $_;
        }
}

Bedanta

-----Original Message-----
From: Vineet Pande [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 17, 2005 4:24 PM
To: beginners@perl.org
Subject: matching pattern & printing

Hi:

In the following perl script, I would like to print all the lines in a file 
(mdout_short.txt) to temp.txt which have "NSTEP" as a word:

************************************************
use strict;
use warnings;

my $mdout_file = "mdout_short.txt";

my $mdout_xtemp_file = "temp.txt";


open IN, $mdout_file or die;
open OUT, ">> $mdout_xtemp_file" or die;


while (<IN>)

                       {

                   print OUT ( $_ =~ ( / NSTEP/ ))

                       }

************************************************************
But this just prints
......
i mean only "6 dots" for six occurences/ matches. How can I get the 
"physical" lines printed rather than these dots?

Cheers,
Vineet

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


-- 
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>


Reply via email to