Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Double Qoutes in string command

by inktuma (Initiate)
on Aug 02, 2013 at 14:03 UTC ( #1047604=perlquestion: print w/replies, xml ) Need Help??
inktuma has asked for the wisdom of the Perl Monks concerning the following question:

Im trying to send a command through the telnet module. This command includes more double qoutes inside of the perl normal two qoutes for string definition. How can i do this ? this is what i have so far...

$telnet->open($host2)or die "cant open \n" ; my $string = "sysBootFileWrite "QSDvxWorks.aif""; $telnet->cmd($string) or die "cant write freakin command";

Thanks

Replies are listed 'Best First'.
Re: Double Qoutes in string command
by choroba (Chancellor) on Aug 02, 2013 at 14:08 UTC
    Read perlop, especially the Quote and Quote like Operators section. You do not need double quotes here, as there is nothing to interpolate, so you can switch to single quotes:
    my $string = 'sysBootFileWrite "QSDvxWorks.aif"';

    For cases where interpolation is needed, you can backslash the inner double quotes or use the qq operator:

    print "He said, \"Hello, $darling.\""; print qq(He said, "Hello, $darling.");
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1047604]
Front-paged by Arunbear
help
Chatterbox?
[choroba]: just one of its angles, in fact
[LanX]: <|--
[choroba]: Reminds me of an old joke about an orchestra...
erix imagines that in a true Lancs accent
[choroba]: so a Czech orchestra rehearses a new piece by a German composer
LanX LOL of the day ... the Turkish Anonymous Alcoholics stopped their "No to alcohol" campaign for political reasons ...
LanX omg my browser is posting again on its own ...
[LanX]: choroba: GREAT JOKE! xD

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2017-03-27 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (319 votes). Check out past polls.