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:xyz 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...
Got something to add? Send me email.
More Articles by anonymous © 2009-11-07 anonymous
An atheist is just somebody who feels about Yahweh the way any decent Christian feels about Thor or Baal or the golden calf. As has been said before, we are all atheists about most of the gods that humanity has ever believed in. Some of us just go one god further. (Richard Dawkins)
Thu Sep 21 09:35:24 2006: 2476 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: 2478 TonyLawrence
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: 2480 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: 2481 TonyLawrence
The only confusion is you thinking that people are going to write programs for you for free.
Perl's (link) "range" operator might help you..
Mon Sep 25 04:43:13 2006: 2482 anonymous
ok taken!! Thanks anyway....I think I will solve it
Mon Sep 25 16:41:58 2006: 2484 anonymous
Try the free sample chapter of the book Pro Perl Parsing. It will teach you what you need to know.
(link)
------------------------
Printer Friendly Version
perl help Copyright © September 2006 anonymous
Have you tried Searching this site?
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.
Contact us
Printer Friendly Version