in reply to filehandle close causes hang

I see only one statement handle ($dtcursor), but I don't see you closing it anywhere, so how do you know your script hangs?

Also, please note that unless you need specifically a list context you can do my $lexical_variable; rather than my ($lexical_variable);. In cases where the function or operator to the right of the equals sign has a different behaviour depending on the context this can really trip you up!

CountZero

PS: please remove the <br> tags and replace them by newlines.

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: filehandle close causes hang
by marymarvel1 (Initiate) on Jun 09, 2008 at 14:58 UTC
    I print the variable in the called subroutine and the date is there. the next statement is the return, I try to print the variable in the calling subroutine, and it never gets to the print statement, it just hangs.
Re^2: filehandle close causes hang
by marymarvel1 (Initiate) on Jun 09, 2008 at 19:05 UTC
    The code should read thus, and I am running perl in sybas usix attaching to sql database:
    my($ddate,$paydate); $ddate = '20080609'; print STDOUT "DATE $ddate\n"; $pay_date = get_medate($ddate); print STDOUT "back in call $pay_date\n"; sub get_medate { use strict 'vars'; my($dte) = "select max(calendar_date) from business_days_table where substring(calendar_date,1,6) =substring('$ddte',1,6) and is_NYSE_open = 'Y' and is_bank_holiday='N'"; print STDOUT "$mesql\n"; my($gt_cursor)=$scb_db->prepare($mesql); $gt_cursor->execute; my($medate) = $gt_cursor->fetchrow ; print STDOUT "MEDATE IN SUB $medate\n"; return $medate; }
    I get the print from the subroutine, I get no print from the calling line or after.

    Jun 14, 2008 at 04:33 UTC McDarren Added code tags