Posted on 2008-11-21 20:28:22-08 by techie
Parsing alias lines
Since this is such an old module, I don't know if it's still being maintained, but I had a minor problem with parsing the aliases. And I want to submit a solution.

Just as a personal preference I like to line up the :'s in the aliases file, so there could be multiple spaces/tabs between the alias name and the ':'. This caused a problem when parsing the line.

I solved the problem by changing this line:

if ($line =~ s/^([^:]+)\s*:\s*//) {

to this:

if ($line =~ s/^([^:\s]+)\s*:\s*//) {

I had to add the '\s' inside the brackets [] to keep a whitespace character out of the parsed index.

Thanks for providing this module.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.