Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to make a sql statement. For this I need to use single and double quotes to make an isql statment to run from the system command like: isql /U username /P /Q "sp_start_job @job_name='HHrun875'"

I do not know how to include single and double quotes also "@" sign to make statement in perl. Any help more than welcome. Regards, Nevzat

Edit kudra, 2002-05-09 Corrected spelling in title, added p and code tags

Replies are listed 'Best First'.
Re: single, doulbe quotes and @ sign
by broquaint (Abbot) on May 09, 2002 at 09:27 UTC
    I assume you're running this command from something like system() or the backtick operator, and if so you have a variety of choices for quoting your command line string. Check out the perlop|perlop manpage for further details about quoting in perl, and the quoting operators (you're positively spoilt for choice!).
    # normal quoting my $str = "isql [options] \"sp_start_job \@job_name='HHrun875'\""; # non-interpolating quoting with q my $str = q(isql [options] "sp_start_job @job_name='HHrun875'"); # interpolating quoting with qq my $str = qq(isql [options] "sp_start_job \@job_name='HHrun875'");

    HTH

    _________
    broquaint

Re: single, doulbe quotes and @ sign
by hopes (Friar) on May 09, 2002 at 09:28 UTC
    Escape them with a backslash; You should read "Quote and Quote-like Operators" in perlop perldoc perlop

    Hopes
    $_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s, $_^=q,$\^-]!,,print
Re: single, doulbe quotes and @ sign
by rdfield (Priest) on May 09, 2002 at 09:28 UTC
    There are any number of ways. Try putting a backslash in front of each of the quotes and @ for a start. This removes the "special" nature of the characters.

    rdfield