⭐ in reply to What is the easiest way of having a configuration file for my program?
The way to parse it isTOKEN1=value1 TOKEN2=value2 ...
This lets you have comment lines and can be easily extended for multi-line values, if needed.while(<>) { if (/^([A-Z_]+)=(.*)/) { my ($TAG,$VAL)=($1,$2); $conf{$1}=$2; } }
%conf=(TOKEN1 => "value1", TOKEN2 => "value2")
|
|---|