Re: Conditional in regex

2007-06-25 Thread [EMAIL PROTECTED]
On Jun 24, 9:05 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > [EMAIL PROTECTED] wrote: > > On Jun 24, 3:31 am, [EMAIL PROTECTED] (Jeff) wrote: > > >> Second, and equally important, what kind of data structure > >> should I put the results in? I think I need a hash of hashes > > > Probably a list o

Re: Conditional in regex

2007-06-24 Thread John W. Krahn
Jeff wrote: On 6/24/07 10:42 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Probably a list of hashes would be the most natural. my @LoH = map { { split } } $file_contents =~ /\{(.*?)\}/gs; Thanks. That's cool. Since this is the beginner's list, I'll just dive in and ask a(nother) d

Re: Conditional in regex

2007-06-24 Thread Jeff
On 6/24/07 10:42 AM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > You don't need to repeat the pattern by hand - the /g will do that for > you. > Thanks to everyone for the replies. I expected what you pointed out above, that /\b(w+)\s+(\w+)\s+/gs would match every instance of the patte

Re: Conditional in regex

2007-06-24 Thread John W. Krahn
[EMAIL PROTECTED] wrote: On Jun 24, 3:31 am, [EMAIL PROTECTED] (Jeff) wrote: Second, and equally important, what kind of data structure should I put the results in? I think I need a hash of hashes Probably a list of hashes would be the most natural. my @LoH = map { { split } } $file_contents

Re: Conditional in regex

2007-06-24 Thread [EMAIL PROTECTED]
On Jun 24, 3:31 am, [EMAIL PROTECTED] (Jeff) wrote: > Hi all. I'm new to perl, a new programmer, and I badly need guidance. I'm > trying to parse a config file with key/value pairs seperated by white space > and surrounded by curly brackets. It has multiple fields that look like > this: > > { > Key

Re: Conditional in regex

2007-06-23 Thread Tom Phoenix
On 6/23/07, Jeff <[EMAIL PROTECTED]> wrote: trying to parse a config file with key/value pairs seperated by white space and surrounded by curly brackets. It has multiple fields that look like this: { Key value Key value } I'll bet it would be easy to parse with Parse::RecDescent. http

Conditional in regex

2007-06-23 Thread Jeff
Hi all. I'm new to perl, a new programmer, and I badly need guidance. I'm trying to parse a config file with key/value pairs seperated by white space and surrounded by curly brackets. It has multiple fields that look like this: { Key value Key value } My solution has been to parse it with som