Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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


Replies are listed 'Best First'.
Re: Double Qoutes in string command
by choroba (Bishop) 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
[hippo]: That was around April 1994. Fun times.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2018-06-22 09:47 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (123 votes). Check out past polls.