On Wed, 6 Jun 2001, Kris Cook wrote:

> Also, I couldn't get my ActivePerl implementation to take the $values inside
> the string.  I had to concatenate them with the '.' operator, as follows:
> $sqlstatement = "INSERT INTO Full (freq, loc, desc, freqtype, cat, call, tx)
> VALUES (".$newfreq.", \'".$newloc."\', \'".$newdesc."\',
> \'".$newfreqtype."\', \'".$newcat."\', \'".$newcall."\', ".$newtx.")";

Ugh.  You can eliminate the backslash-itis by using the general double
quote operator.  It makes your code much cleaner and easier to read.
Here, qq{stuff} is the same as "stuff".

$sqlstatement = qq{INSERT INTO Full (freq, loc, desc, freqtype, cat, call,
tx) VALUES($newfreq,'$newloc','$newdesc','$newfreqtype','$newcat','$newtype',$newtc)};

Or use a heredoc:

$sqlstatement = <<"SQL";

INSERT INTO Full (
        freq,
        loc,
        desc,
        freqtype,
        cat,
        call,
        tx
) VALUES (
        $newfreq,
        '$newloc',
        '$newdesc',
        '$newfreqtype',
        '$newcat',
        '$newtype',
        $newtc
)
SQL

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]


Reply via email to