nice. thanks for all of that.

it was late (err early), so i missed chromatic et al's suggestion that if didn't reassign $_. however, the if was getting unwieldy and just didn't look good assigning the param to the scalar so i didn't want to do it like that. in the end, i did this:

if ( $cgi->param ) { $sortby = defined ( $cgi->param( 'sortby' ) ) ? $cgi->param( 'sortby' ) : "name"; $ascdesc = defined ( $cgi->param( 'ascdesc' ) ) ? $cgi->param( 'ascdesc' ) : "desc"; $letter = defined ( $cgi->param( 'letter' ) ) ? $cgi->param( 'ascdesc' ) : " "; ownertbl( $sortby, $ascdesc, $letter );

which works fairly well but always ends up true (i think) this is because i am defining my cgi vars in all requests to keep my state (so that if one thing changes everything else doesn't go away). maybe i'll try and test  $($cgi->param( 'whatever' )) > 0 and see if i can make this work.

my other issue is the sql paren is doubling up per:

[Sat Oct 16 11:04:23 2010] [error] [client 192.168.15.177] DBD::mysql: +:st execute failed: You have an error in your SQL syntax; check the m +anual that corresponds to your MySQL server version for the right syn +tax to use near 'WHERE name LIKE '%'' at line 3 at /var/www/cgi-bin/o +wnertbl.pl line 76., referer: http://192.168.15.222/cgi-bin/ownertbl. +pl [Sat Oct 16 11:04:23 2010] [error] [client 192.168.15.177] DBD::mysql: +:st fetchrow_hashref failed: fetch() without execute() at /var/www/cg +i-bin/ownertbl.pl line 79., referer: http://192.168.15.222/cgi-bin/ow +nertbl.pl [Sat Oct 16 11:04:23 2010] [error] [client 192.168.15.177] base = http +://192.168.15.222/cgi-bin/ownertbl.pl, sort = ORDER BY name, sortby = + name, ascdesc = , letter = WHERE name LIKE '%', referer: http://192. +168.15.222/cgi-bin/ownertbl.pl

but, i haven't really studied your sql suggestions so i'm hoping with a closer look at that i'll be able to fix this too.

thanks for the help


In reply to Re^2: passing variables to a sub by Anonymous Monk
in thread 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.