The following code is printing out:
when I would have expected
config.txt contains one line
This really has me stumped as I'm not sure if I'm missing something obvious or what.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
Code:
D:/temp
2/temp
/test.rtf
Code:
D:/temp
D:/temp 2
D:/temp/test.rtf
config.txt contains one line
Code:
temp_dir=D:/temp
Code:
use strict;
my %config;
my $config_file = 'config.txt';
#Get the config data
open(CONFIG, "<$config_file");
while(<CONFIG>){
chomp;
my ($k, $v) = split(/\s*\=\s*/, $_,2);
$k = lc $k;
$config{$k} = $v;
}
close(CONFIG);
print "$config{temp_dir}\n";
print "$config{temp_dir} 2\n";
my $tmp_file = "$config{temp_dir}/test.rtf";
print "$tmp_file\n";
exit;
This really has me stumped as I'm not sure if I'm missing something obvious or what.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;