You could even write this as:my %config; m[^([^#][^=]+)=(.*)$] and $config{ $1 } = $2 while <DATA>;
There is an example somewhere in the perldocs that gives essentially the same technique for parsing simple config files, though I can't find it right now. I always thought it was ingenius & wonderfully succinct. It certainly applies nicely here.my %config = map { /^([^#][^=]+)=(.*)$/ } <DATA>;
blokhead
In reply to Re^2: split line and populate hash shortcut ?
by blokhead
in thread split line and populate hash shortcut ?
by leocharre
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |