To interpolate a variable within a string, enclose it in " " quotes. If you want to interpret the string literally, you can use ' ' quotes. See perldata for more information.

To concatenate strings, use the . operator as discussed in perlop.

Your code features several lines of the form:

$telnet->print('helo '$v_server);

Note that you attempt to pass a literal string ('helo') and concatenate it (with $v_server), but you didn't use the concatenation operator, hence the syntax error.

I believe you were looking for either of the following:

$telnet->print('helo '.$v_server); # Concatenation method $telnet->print("helo $v_server"); # Interpolation method

Lastly, your suspicions about $telnet->print('helo $v_server'); were correct -- it does not interpolate, and consequently prints the literal string: helo $v_server.


In reply to Re: anonymous email client by eibwen
in thread anonymous email client by surfbass

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.