[Cialug] Perl regex

Daniel A. Ramaley daniel.ramaley at DRAKE.EDU
Tue Jun 19 11:35:54 CDT 2007


On Tuesday 19 June 2007 11:11, Josh More wrote:
>Instead of slurping (bad habit, btw), read line by line in a while.
>Then, split each line on the =, and assign to a hash with the
>concatenate operator.

Thanks for the response! I guess i should have provided more detail as 
to my problem specification. Your sample code was very similar to what 
i'm trying to replace.

The files in question are guaranteed to only be a few kB in size, so 
slurping them is not a problem. I have a few reasons for wanting to 
process the file as one big string rather than break it into a hash and 
reconstituting the file later:
1) Character set detection/conversion (input files are one of ASCII,
   ISO-8859-1, or UTF-8; i'm converting to UTF-8 as necessary).
2) Comments should be preserved.
3) Original line ordering should be preserved.

------------------------------------------------------------------------
Dan Ramaley                            Dial Center 118, Drake University
Network Programmer/Analyst             2407 Carpenter Ave
+1 515 271-4540                        Des Moines IA 50311 USA


More information about the Cialug mailing list