Feb 27, 2006 #1 misho88 Technical User Joined Feb 26, 2006 Messages 2 Location 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 Joined Sep 26, 2002 Messages 4,469 Location 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 ;-)