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

Hi,
Im extremely newbie, in fact this is my first cgi script being a designer by default.   i have a question, to print variables in the enail to be sent you type "print MAIL"...

i have encountered a line that says: print "rtn_name=$NAME";

i assume this is supposed to return the variable $NAME to the site that requested it. What i dont understand is, where did "rtn_name" come from? there is no mention or defining of it anywhere in the source files packaged with it. Is this suppoosed to be defined by me?

Thanks
jenna.

janitored by ybiC: Retitle from less-than-descriptive "print" because one-word titles hinder effective searching. Also minor format tweaks for legibility

  • Comment on Print and strings and variable names in strings

Replies are listed 'Best First'.
Re: Print and strings and variable names in strings
by thor (Priest) on May 26, 2004 at 12:01 UTC
    rtn_name in the context that you provided is nothing but something to be printed. In perl, variables are prefixed with a sigil (a funny symbol that denotes what type of variable it is). In this case, you have $NAME, which because of the sigil (a dollar sign) denotes that it is a scalar variable. Also, the line that you reference would print "rtn_name=<value of $NAME>" to whatever the script thinks is standard out. WIthout seeing more of the script, it's a bit difficult to diagnose anything further.

    thor

Re: Print and strings and variable names in strings
by punkish (Priest) on May 26, 2004 at 22:48 UTC
    i have encountered a line that says: print "rtn_name=$NAME"; i assume this is supposed to return the variable $NAME to the site that requested it. What i dont understand is, where did "rtn_name" come from? there is no mention or defining of it anywhere in the source files packaged with it. Is this suppoosed to be defined by me?
    Think of it this way. If...

    $NAME = 'jenna';

    Then the line -- print "rtn_name=$NAME"; -- will result in...

    rtn_name=jenna