Ok... to handle the problem chromatic and I pointed out do this.

queryresult($s_off_no);

This is good you loaded the $s_off_no variable into the @_ array

Here is the problem

my $s_off_no = $s_off_no;

^ Here you do not touch the var you loaded into @_. You just take the (lexical scoped to the main package) $s_off_no and assign it to (lexical scoped to the sub) $s_off_no (You hope)

What you should really be doing is

my ($s_off_no) = @_;

This insures there is no ambiguity to where the the var is coming from. Honestly, I do not know if the perl interepets the RHS as the sub scoped lexical of your statement because I have never done this, but it not only introduces ambiguity to you code (possible problems for the interpreter) it also makes it difficult to read for other people (including youself in a month).



PS: as a side node you are loading all the CGI functions into you main namespace.

 use CGI ':standard';

But you use the OO interface

 my $q = new CGI;

you should be able the ditch the ':standard' on the use CGI;



grep
Unix - where you can throw the manual on the keyboard and get a command

In reply to Re: Re: Re: CGI or DBI 'cache' problem by grep
in thread CGI or DBI 'cache' problem by slok

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.