Hello all,
I have two lists from DB queries with one common variable for comparison for a match. What I want to do is loop through each entry in the first list @problem and check for a match in the second list @device and if a match is not found, assign default values to the @device variables and then go to the next entry in @problem. Heres what I have
I got a Biz Degree! How the h*ll did I get here?
I have two lists from DB queries with one common variable for comparison for a match. What I want to do is loop through each entry in the first list @problem and check for a match in the second list @device and if a match is not found, assign default values to the @device variables and then go to the next entry in @problem. Heres what I have
Code:
foreach $prob (@problem) {
my ($common_prob, $probvar1, $probvar2, $probvar3) = split (/,/, $prob);
foreach $dev (@device)
my ($common_dev, $devar1, $devar2, $devar3) = split (/,/,$dev);
if ($common_dev eq $common_prob) {
$myhash{$probvar1} = ("$probvar2,$probvar3,$devar1,$devar2,devar3");
}else{
$devar1 = "default1";
$devar2 = "default2";
$devar3 = "default3";
$myhash{$probvar1} = ("$probvar2, $probvar3, $devar1, $devar2, $devar3");
I got a Biz Degree! How the h*ll did I get here?