> -----Original Message----- > From: Singh, Harjit [mailto:[EMAIL PROTECTED] > Sent: Monday, August 09, 2004 4:05 PM > To: [EMAIL PROTECTED] > Subject: Trying To write a script > > > I am trying to write a script that would be able to read a file. The > file is broken into number of segments and each segment starts with a > similar string pattern of following type: 2.2.x.y.z: followed with > white space, where x, y, z numbers change throughout the file. The > segment further has number of things that I am looking for. I want to > be able to capture the segment value in addition to other things in a > specific segment. What is the best approach to be able to make this > possible? I have tried number of things but have not been able to > capture the right regular expression to capture the information. I > would appreciate if any one can send in their response... > > Regards, > Harjit Singh >
Can you send a file example. Don't considering the file size. use Data::Dumper; my @file = split(/(2\.2\./d+\./d+\./d+) /, $fileText); shift(@file); my %blocks = @file; print(Dumper(\%blocks)); In blocks you would find the keys read to be parsed and the values as being the rest. One real example cloud help. Marcos -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>