Up Prev Next
From: Julia Stone <Julia dot Stone at msdw dot com>
Subject: Here document troubles w/ SQL
Date: Jun 20 2000 8:42PM
I am having a problem with using a scalar variable in my here document.
Here is a small example of my problem:
my $sql = <<"EOSQL";
WHERE dept = "$dept_name"
I want to loop through department names. I have done this before
without a loop. But this time I continually end up with an empty
foreach my $school_dept (@all_depts)
$dept_name = $school_dept;
# I'll check to make sure the value of $dept_name is correct,
and it has been
print "Value of dept_name: $dept_name \n";
my @row = $data_dbh->nsql($query,"ARRAY");
die "$cmdname: $DB_ERROR, stopped at" if $DB_ERROR;
print "Query: $sql \n";
When I print the $sql value it consistently returns with the following:
WHERE dept = " "
All values are in place, but somehow this $sql isn't able to resolve
$dept_name ... anyone have any ideas why?