CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Reading a part of blcok in a file

 



per'l'over
Novice

Aug 28, 2008, 3:08 AM

Post #1 of 1 (1688 views)
Reading a part of blcok in a file Can't Post

  I am new to perl.I have to read a .txt file which appears like the below format

always @ ( posedge of clk or
negedge of clk
both edge of clk)

I have to read the above code.ie we have to read the file which starts with always and ends with ")"character and have to print

<code>

open ($file,"file.txt");

while (<$file>)
{
if($_=~/^\s*always (.*) )
{
print $_;
if($_!~/\)\s*$){

next; //here i am getting confused on how to go to next line

}
<\code>

This is i tried sofar.Ifyou would help me i am so glad to you
thanks
Ravindra


(This post was edited by per'l'over on Aug 28, 2008, 3:30 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives