so, i'm thinking my understanding of variables is somehow off. when i pass my ($int1, $int2) to a subroutine like somesub($int1, $int2) and call it inside the sub with ($int1, $int2) = @_ they become are not defined. to more explicit, here's extracts of my code:

my ($ownsel, $sortby, $letter, $ascdesc, $t); ... if ( $cgi->param ) { if ( defined ( $cgi->param( 'sortby' ) ) ) { $sortby = $_; } else { $sortby = "name"; } if (defined ( $cgi->param( 'ascdesc' ) ) ) { $ascdesc = $_; } else { $ascdesc = "desc"; } if (defined ( $cgi->param( 'letter' ) ) ) { $letter = $_; } else { $letter = " "; } ownertbl( $sortby, $ascdesc, $letter ); } else { homepage(); } ... sub ownertbl { ( $sortby, $ascdesc, $letter ) = @_; ... $sort = "ORDER BY " . $sortby . $ascdesc; ... print STDERR "base = $base, sort = $sort, sortby = $sortby, ascdes +c = $ascdesc, letter = $letter\n";

this is a cgi script, so from apache's error.log, i'm getting this:

Use of uninitialized value $ascdesc in concatenation (.) or string at +/var/www/cgi-bin/ownertbl.pl line 71., base = http://192.168.15.222/cgi-bin/ownertbl.pl, sort = ORDER BY name +, sortby = name, ascdesc = , letter = ,

line 71 is the  $sort = "ORDER BY......" i've dealt with this before by just doing $_[0], but this is not preferred when dealing with multiple variables. where am i messing up here.

btw, this seemed relevant but didn't really answer my question:

http://perlmonks.org/index.pl?node_id=192506

In reply to passing variables to a sub by ag4ve

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.