|
|
| There's more than one way to do things | |
| PerlMonks |
Re^3: how to read perl variable from a line read from a fileby Anonymous Monk |
| on Jan 31, 2013 at 16:39 UTC ( #1016356=note: print w/ replies, xml ) | Need Help?? |
|
It's not perfect. It's missing a close $fh and the substitution regexp probably should be s/\$([a-z]+)/ $vars{$1} || "\$$1" /gie; to give a somewhat sane behaviour for undefined variables (instead of substituting them with the empty string. Which is what *nix shells do, so I guess it's not that bad...)
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||