michellem has asked for the wisdom of the Perl Monks concerning the following question:
I'm sure there is something really obvious I'm missing, or something stupid I'm doing (as usual), but I'm utterly stumped.
I have a pretty large complex perl-cgi project, and right now, I'm running into strange problems with references. I've got one particular script that just hangs, without throwing any errors in the error logs.
Here's the snippet that I've identified is the problem:
foreach my $record (@records) { foreach my $key (keys %$record) { print "$key:$record->{$key}"; print $q->br; } }
The array of hashes is originally gotten from a subroutine. If I just print the key, I don't get the strange hanging with no error. It just prints the keys, executes some more code like it's supposed to, and exits like it's supposed to. It also doesn't seem to want to let me use the reference in any if statements.
If I use the code:It hangs too. I'm just at my wits end with this. There is another piece of code too that seems to cause this behavior, it's more complicated, but it basically involves sending values to CGI parameters.foreach my $record (@records) { foreach my $key (keys %$record) { if ($record->{$key} =~ /client/) {print "this is a client" +; print $q->br;} } }
I can handle it when I get error messages - then I know what to look for. But hanging with no errors is driving me crazy.
This is perl 5.8.0, RH9, Apache, etc. I'm using strict and warnings. I also unbuffered stdout. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with references?
by cLive ;-) (Prior) on Oct 07, 2003 at 05:51 UTC | |
|
Re: Problems with references?
by davido (Cardinal) on Oct 07, 2003 at 05:54 UTC |