[Cialug] Perl regex

Nathan Stien nathanism at gmail.com
Tue Jun 19 11:22:15 CDT 2007


On 6/19/07, Josh More <morej at alliancetechnologies.net> wrote:
> You code will work better and be easier to maintain if you approach the
> problem differently.
>
> 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.

You beat me to it.  I was typing up a response about splitting on '=' as well.

Also, I don't know if the OP needs to deal with an end of line comment:
C=cookies  # that's good enough for me
Or a comment starting past the first column at all

A=apples
  # B=bumpkins
D=dorks

A has entry for " # B" would have been created.  Not sure if that's important.

-- 
Nathan P. Stien
Consulting Engineer / Software Developer
Embedded Systems Electronics and Software
http://linkedin.com/in/nathanstien
Mobile: 309.241.2581


More information about the Cialug mailing list