That's the ticket! thanxs.. not up to par on regex yet.. I had to modify a module I got from cpan to remove the comments.. the darn thing just check for spaces and comments at beginning of line :(
-Ron > -----Original Message----- > From: Frank [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 14, 2002 12:53 > To: Beginners (E-mail) > Subject: Re: excluding comments in a line > > > On Mon, Jan 14, 2002 at 12:44:34PM -0500, Yacketta, wrote: > > Folks, > > > > I am reading in a .cfg file and exclude comments (#) and > spaces at the > > beginning of the line > > how would I lop off any comments in a line? > > > > IE: > > > > Key "value" # comment here > ---end quoted text--- > > while(<CONFIG>){ > next if /^\s*(#.*)?$/; # Skip it if just comment or blank > s/#.*$//; # remove comments > ($key,$value)=split/\s+/,$_,2; # Get exactly two values out > $config{$key}=$value; # Load into a hash for use. > } > > -- > Frank Booth - Consultant > Parasol Solutions Limited. > (www.parasolsolutions.com) > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]