Re: Quotes and apostrophes assistance



"Beginner" schreef:

my ($rows) = $dbh->selectrow_array("SELECT foo FROM bar where
path=?",undef,q($name)) or die ....snip

Your q($name) creates the literal string $name.

my ($rows) =
$dbh->selectrow_array(
"SELECT foo FROM bar where path=?",
undef,
$name,
);

No need for die() if you set up the $dbh with 'RaiseError' on,
see perldoc DBI. Also look for 'trace'.

--
Affijn, Ruud

"Gewoon is een tijger."
.



Relevant Pages

  • Re: question on de-referencing expressions
    ... TZ> It's worth noting here that if the returned value is undef, ... TZ> will die here. ... Note that the first test ... Can't use an undefined value as a HASH reference at -e line 1. ...
    (comp.lang.perl.misc)
  • Re: My editfile.pl script
    ... If you don't know what a lexical filehandle is, ... my $before = undef; ... die $usage unless $line; ...
    (comp.lang.perl.misc)
  • Re: question on de-referencing expressions
    ... TZ> It's worth noting here that if the returned value is undef, ... TZ> will die here. ... Note that the first test ...
    (comp.lang.perl.misc)
  • Re: using $! for die()ing with Package function
    ... Jonathan Paton wrote: ... I prefer undef for false. ... bazor die $!; ... sub baz { ...
    (perl.beginners)
  • Re: local *FH
    ... open FH,$path or return undef; ... Because local would protect the global file-handle FH which maybe was ... open HD,'/etc/resolv.conf' or die $!; ...
    (perl.beginners)