surfbass has asked for the wisdom of the Perl Monks concerning the following question:

ok im making this anonymous email client, and its pretty basic as of now, but i need the net::telnet module to reckonize(sp?) the variables when comunicating with the smtp server. check out this link to view the code: http://s3.invisionfree.com/information_leak/index.php?showtopic=1138
ive tried many deviations, but it either has the wrong syntax or the telnet module is printing $variable literally, and not printing what it is. could i get some help here?

Replies are listed 'Best First'.
Re: anonymous email client
by eibwen (Friar) on May 09, 2005 at 01:16 UTC

    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.

      :0 i am impressed. i just dont know what to say. i am impressed. by the promptness, the thoroughness(sp?) and just the profesionalism in that reply. thank you so much. *sniff*
Re: anonymous email client
by Juerd (Abbot) on May 09, 2005 at 09:04 UTC