Feb 27, 2006 #1 misho88 Technical User Feb 26, 2006 2 CA I have a file with a number of lines in the form: varname=value What's the easiest way to make this translate into a variable $varname=value ?
I have a file with a number of lines in the form: varname=value What's the easiest way to make this translate into a variable $varname=value ?
Feb 27, 2006 #2 PaulTEG Technical User Sep 26, 2002 4,469 IE Code: open FH, "<file.txt"; my %vars; while (<FH>) { my ($key,$value)=split /=/,$_; $vars{$key}=$value; } close FH; Paul ------------------------------------ Spend an hour a week on CPAN, helps cure all known programming ailments ;-) Upvote 0 Downvote
Code: open FH, "<file.txt"; my %vars; while (<FH>) { my ($key,$value)=split /=/,$_; $vars{$key}=$value; } close FH; Paul ------------------------------------ Spend an hour a week on CPAN, helps cure all known programming ailments ;-)