Ing. Branislav Gerzo wrote:
Hi all,

I have little formatting problem, we have code:

sub test {
  $sth = $dbh->prepare_cached(<<SQL);
  INSERT INTO table (ip, port, type, create_date)
  VALUES (?,?,?,?)
  SQL
  $sth->execute('12.12.12.12', 80, proxy, '2002-12-12');
  $sth->finish;
  return;
}

this of course doesn't work, because SQL is not at begining of the
line. I tried:
  $sth = $dbh->prepare_cached(<<"  SQL");

and that works. But could I use regexp for that? something like this:

  $sth = $dbh->prepare_cached(<<\s*SQL);

it is just cosmetic question, but i'd like to know answer....

No, you can't use the regex. For more discussion see:

  perldoc -q "Why don't my <<HERE documents work?"

I prefer this construct:

  $sth = $dbh->prepare_cached(q[
     INSERT INTO table (ip, port, type, create_date)
     VALUES (?,?,?,?)
  ]);


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to