Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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";


Comment on Double Qoutes in string command
Download Code
Replies are listed 'Best First'.
Re: Double Qoutes in string command
by choroba (Canon) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1047604]
Front-paged by Arunbear
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2015-11-26 08:39 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls