(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



perl help



Author: anonymous
Date: Thu Sep 21 09:30:32 2006
Subject: perl help

Hi.. 
     I am going through following problem. 
Let me explain you.... 
 
 I have to extarct information from the file... 
 
lets file is x.v 
 
   module x; 
 
   pattern:start 
   p1; 
   p2; 
   endpattern 
  
   endmodule 
 
   module y; 
    
   pattern:xxx 
    p3; 
    p4; 
   endpattern 
    
   endmodule 
 
    
I am extracting information from the file and creating a hash map. 
I need to store.. 
 
{module name} = pattern content... 
 
here I will be like this 
 
hashmap{x} = p1 p2 
hashmap{y} = p3 p4 
 
How cam I do that.......... 
I am struggling... 
 



More Articles by anonymous




Click here to add your comments





Thu Sep 21 09:35:24 2006: Subject:   anonymous


Need a stopping condition...

ex:
module m1;

endmodule

module m2;

endmodule

so like
while<fp_ptr> {

if (/module\s*(\w)\)?.*/) {
my moduleName = $1;
}
parse till encounter endmodule... Then start from the beginning.
This condition I want.

}

The file can contain... n module definition.



Fri Sep 22 13:19:32 2006: Subject:   TonyLawrence

gravatar
This smells like a course assignment.


There's nothing hard here.. it's pretty basic parsing.

I doubt anyone here is going to do your homework for you. If you provided code you tried to write that didn't work, we MIGHT help you out if you explain it well and aren't just dumping a bunch of junk.

Otherwise, sorry, but no.



Sun Sep 24 04:12:34 2006: Subject:   anonymous


I think I have confused everybody...

Here in short what I want to do...

I want to extract pattern from the file which can come multiple times...

pattern_1 any_thingh

pattern_2:anything /*I want to extract
anything pattern_2 to pattern_3 and store that
anything in a string
pattern_3 */


pattern_4

patten2 - pattern3 can come multiple time inside patten1- pattern2..








Sun Sep 24 11:39:44 2006: Subject:   TonyLawrence

gravatar
The only confusion is you thinking that people are going to write programs for you for free.



Mon Sep 25 04:43:13 2006: Subject:   anonymous


ok taken!! Thanks anyway....I think I will solve it




Mon Sep 25 16:41:58 2006: Subject:   anonymous


Try the free sample chapter of the book Pro Perl Parsing. It will teach you what you need to know.

http://www.apress.com/book/bookDisplay.html?bID=432

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



/Forum/anonymous41.html copyright September 2006 anonymous All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server






More:
       - Forum


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress