Ignore the following question - I was in Blair mode, confusing cause and effect! The problem wasn't strictly the return, more the fact that the values it was trying to return had been destroyed in the fetchrow_array - the full code is printed below if anyone feels like scoffing! Feel free to scoff as I won't hear being in the lowest, wettest smelliest cell possible for an errant monk!


Hello again Bretheren. Can anyone give me advice on a little difficulty I am having with a return value from a subroutine? I need to return 2 values - calculated via 2 calls to the DBI in the subroutine - I have these values in an array which I am trying to return but with no joy. I have even dallied with reurning a reference to this array but don't seem able to dereference it. Can you help/point me in the correct direction/show me the error of my ways? For what it's worth the code from the latest (failed) attempt is appended. Cheers, Ronnie
# return $rarray ; # Reference to the array # } # ####################################################### # Variables # ####################################################### # my $to = 'ronniec@it.aberdeen.net.uk' ; my $from = 'Buckethead' ; my $logfile = 'xxrc_test_DBI_special.log' ; my $DB_name = 'isw-test' ; my $result = 0 ; my $count = 0 ; my $response = () ; # ##################################### # mail_log variables. # ##################################### # my $script = 'chk_cals' ; my $mail_msg = 0 ; my $null = "none" ; my $subject = "Script $script completion details" ; my $msg = "See attachment for completions details" ; my $text = "\tUnable to write the following to $logfile + :-\n\n" ; my $row = undef ; # print "\n\t<************ SOR $0 ***************>\n" ; # $response = &chk_cals("$to","$from","$logfile","$DB_name") ; # print "\n\tBetcha dinna c this min - $$response[0]\n" ; #

In reply to Return Value Problem by Ronnie

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.