in reply to Re: Parsing a Text File
in thread Parsing a Text File

if(/^([A-Z]+)\s*/)
The final  \s* is meaningless here; it will always be true.

Also, based on the data set, he may want to use whitespace in his hash keys. How about this?

if (/^([A-Z][A-Z\s]*)/)
I decided to make sure that the first character is uppercase, but allow whitespace after that.

buckaduck

Replies are listed 'Best First'.
Re: Re: Re: Parsing a Text File
by suaveant (Parson) on Apr 12, 2001 at 16:19 UTC
    Opps, I meant...
    if(/^([A-Z]+)\s*$/)
    To prevent a line starting with a capitol letter but having other stuff... but to allow a whitespace after the marker, just in case.
                    - Ant