Ah.  Both are easier.  I especially like the here-doc method, which is what
I should have used.  Thanks, Brett.

> -----Original Message-----
> From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 06, 2001 3:15 PM
> To: Kris Cook
> Cc: 'SAWMaster'; [EMAIL PROTECTED]
> Subject: RE: This n' that
> 
> 
> 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