Gossamer Forum
Home : General : Perl Programming :

Re: [Andy] string matching problem

Quote Reply
Re: [Andy] string matching problem In reply to
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.

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.
Subject Author Views Date
Thread string matching problem delicia 4397 May 7, 2020, 5:58 PM
Thread Re: [delicia] string matching problem
Andy 4320 May 7, 2020, 11:36 PM
Thread Re: [Andy] string matching problem
delicia 4313 May 8, 2020, 5:54 AM
Thread Re: [delicia] string matching problem
Andy 4305 May 8, 2020, 6:17 AM
Thread Re: [Andy] string matching problem
delicia 4316 May 8, 2020, 6:36 AM
Post Re: [delicia] string matching problem
Andy 4292 May 8, 2020, 6:39 AM