Normally system("/bin/echo \\\$stuff"); returns $stuff. this is true, after learning from a few mistakes (like \\$stuff) i felt as though i understood how to get a $ back from an object. alas this is not so. the Net::Telnet object does not seem to retrieve $'s. am i wrong in this? as i believe i have code to back me up on this one.
#!/usr/bin/perl -w use strict; use Net::Telnet; my $username = "user"; my $password = "password"; my $host = "localhost"; my $telnet = new Net::Telnet ('Timeout'=>'7', 'Prompt'=> '/.*([\$#\%>~]|\\\[\\e\[0m\\\ +] \[0m)\s?/' ); ; my $shiznat = "default value"; $telnet->open(Host=>$host); $telnet->login($username,$password); $telnet->dump_log("loging.log.log"); $telnet->cmd('String' => "/bin/echo \\\$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat; $telnet->cmd('String' => "/bin/echo \$stuff", 'Output' => \$shiznat); print $shiznat; $shiznat=$telnet->getline; print $shiznat;
this outputs
stuff stuff
anyone have any thoughts? (please note that getline will not solve the programs problem(just my curiousity) i am actually developing as i have to deal with a 6 line file (unless you can make it read all 6 (possibly 18) lines)) it appears (to me in my ignorance) that this should work correctly (well the 1st cmd the second is just to prove a point about $'s and how the escaping does not change the output) and if you check the log file you will discover that $stuff was echoed but only stuff returned to you for use
curious, no?
jcpunk

by the way thanks for all the help that was, is, and will be


In reply to Net::Telnet, $, and crushed expectations by jcpunk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.