Dec 8, 2017, 11:25 AM
Post #1 of 3
I want to use single quotes to both ends of $dataval but getting an error invalid identifier error on $dataval variable. How should I correct the statement below?
how to append single quote to both ends of $ variable
my $dataval = $dbh -> prepare(qq(select col1, col2 from sometable))
my $genextract = $dbh->prepare(qq(select col1, col2, col3 from sometable WHERE col2 = "'"$dataval"'")
The query should read like below
select col1, col2, col3 from sometable WHERE col2 = 'dataval'