On Fri, 17 May 2002, Mark Anderson wrote:
> It works for me (using perl 5.6.1), what seems to be the problem?  
> Why do you want to do this instead of just having three print statements?
> Are you sure that you have data in the thre variables?

FWIW: Looking back at my original script, I had declared the variables 
$name, $age, $phone *OUTSIDE*OF* the foreach loop. That's why they were 
undefined!!!

  my ($name, $age, $phone);
  foreach (qw(name age phone)) { 
    print ${$_};
  }

(What a bone-head!)

Actually, what I was *trying* to do was dereference variables and pass
their values to DBI->quote() to build a string. e.g.,

  # Build the value string 'eric','34','555-1212'
  foreach ($age $name $phone) {
        $values .= $dbh->quote($_) . ',';
  }
  # Remove the extra comma at the end
  chop $values;

  $dbh->do(INSERT INTO $dbfile ($column_names) VALUES ($values));

I suppose that I should just pass the variable's *value* to quote() 
instead of trying to pass the variable itself. 

Thanks!

-- 
Eric P.
Los Gatos, CA


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to