dumper shows:
$VAR1 = { 'test' => 'delicia', 'user_id' => undef };
see chomp below. get record is used for one-to-one relationship and doesn't call array to hash. for some reason it isn't matching $key2 to $data[0]. i guess the problem is related to the split_decode in my other post about using the colon as a delimiter.
flock(DBX, 1);
LINE: while (<DBX>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_;
chomp ($line);
@data = &split_decode2($line);
#next LINE if ($restricted and ($db_userid ne $data[$auth_user_field]));
if ($data[$db2_key_pos] eq $key2) {
$found = 1;
for ($j = 0; $j <= $#db2_cols; $j++) { # Map the array columns to a hash.
$rec2{$db2_cols[$j]} = $data[$j];
}
last LINE;
}
if there's some reason i can't use the colon as a delimiter, i can just use that as a condition to use a regular split function.
$VAR1 = { 'test' => 'delicia', 'user_id' => undef };
see chomp below. get record is used for one-to-one relationship and doesn't call array to hash. for some reason it isn't matching $key2 to $data[0]. i guess the problem is related to the split_decode in my other post about using the colon as a delimiter.
Code:
open (DBX, "<$db2_file_name") or &cgierr("error in get_records. unable to open db file: $db2_file_name.\nReason: $!"); flock(DBX, 1);
LINE: while (<DBX>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_;
chomp ($line);
@data = &split_decode2($line);
#next LINE if ($restricted and ($db_userid ne $data[$auth_user_field]));
if ($data[$db2_key_pos] eq $key2) {
$found = 1;
for ($j = 0; $j <= $#db2_cols; $j++) { # Map the array columns to a hash.
$rec2{$db2_cols[$j]} = $data[$j];
}
last LINE;
}
if there's some reason i can't use the colon as a delimiter, i can just use that as a condition to use a regular split function.