> I wondered if any can shed some light on this.
>
> Basically, I am executing an SQL query to MySQL, but what I need to do is
> escape the ' character inside a scalar, like this :
>
> $auction_id = param('auction_id');
> $window_title = param('window_title');
> $auction_title = param('auction_title');
> $startbid = param('startbid');
> $description = param('description');
> $jpeg = param('jpeg');
> $filename = param('filename');
> $auction_name = param('auction_name');
>
> $statement=q{UPDATE
> auctions
> SET
> windows_title = '$window_title',
> auction_title = '$auction_title',
> startbid = $startbid,
> description = '$description',
> jpeg = '$jpeg',
> filename = '$filename',
> auction_name = '$auction_name'
> WHERE
> auction_id = $auction_id};
>
> Why does the escape the $ character if it is meant to how can I just get
it
> to escape the contents of all the scalars?
This is indeed a strangely worded question, but I think what you are asking
is: why is perl just using my variable names instead of taking their values?
If so, the answer is that you probably want the qq operator, not the q
operator.
qq interpolates variable values. Thus:
$x = 'a';
print '$x'; # prints $x
print "$x"; # prints a
And of course, q is like '', qq is like "".
Ken Bandes
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs