Ok so my head has now become so fuzzy I cant think straight, so I ask my mates to help me out of this hole I'm digging:
The code:
At the top I have this ....
$data_file="passfilelist1.txt";
open( TEST, "$data_file" ) or die;
chomp( %hash = map { split /,/ } <TEST> );
close TEST;
foreach( sort keys %hash ) {
$protect="\$protect{'$_'}='$hash{$_}'\;\n";
# print $protect;
}
Now that works fine standalone but this is to replace what was a list of vars defined in the script like this:
$protect{'Admin'}='/home/fred/paswd/.htusers1';
$protect{'Finance1'}='/home/bob/paswd/.htusers1';
$protect{'Telecare'}='/home/jill/paswd/.htusers1';
$protect{'newone'}='/home/jenny/paswd/.htusers2';
I now want to get the values from the external file (passfilelist1.txt) hence the first piece of code above
Later in the script it uses the values of %protect for:
## CREATE SELECT LIST ##
foreach $key (sort_hashs(\%protect)) {
$select .= "<option value=\"$key\">$key";
}
But I dont appear to be getting the value from the first piece of code into this next piece !!
Sorry its late and my head is spinning ...... HELP!
L.
The code:
At the top I have this ....
$data_file="passfilelist1.txt";
open( TEST, "$data_file" ) or die;
chomp( %hash = map { split /,/ } <TEST> );
close TEST;
foreach( sort keys %hash ) {
$protect="\$protect{'$_'}='$hash{$_}'\;\n";
# print $protect;
}
Now that works fine standalone but this is to replace what was a list of vars defined in the script like this:
$protect{'Admin'}='/home/fred/paswd/.htusers1';
$protect{'Finance1'}='/home/bob/paswd/.htusers1';
$protect{'Telecare'}='/home/jill/paswd/.htusers1';
$protect{'newone'}='/home/jenny/paswd/.htusers2';
I now want to get the values from the external file (passfilelist1.txt) hence the first piece of code above
Later in the script it uses the values of %protect for:
## CREATE SELECT LIST ##
foreach $key (sort_hashs(\%protect)) {
$select .= "<option value=\"$key\">$key";
}
But I dont appear to be getting the value from the first piece of code into this next piece !!
Sorry its late and my head is spinning ...... HELP!
L.