S3 has asked for the wisdom of the Perl Monks concerning the following question:
My assignment at work was to make a small program that sends out about 9000 mail to customers of a client of ours.
Sending mail from a Perl-script is almost to easy to be true, so that is not my problem.
When I make a script/program I always try to make small test-scripts for each sub in the program.
I have a sub that reads an ini-file that returns a hash containing the ini-file settings and in the testscript it behaves just as expected.
When I move the EXCACT same code to the main script it fails with an error:
"Odd number of elements in hash assignment at SendMail.pl line 19."
The lvalues is of the same type to.
When I use Data::Dumper to print the hash returned from the sub it prints this:
$VAR1 = { '9/16' => undef };
Now, if the behaviour was consistent it would be something I could live with, but this really puzzles me.
Here's the best part:
When I return a reference from the sub it works like a charm (after changing the lvalue type and argument to Data::Dumper).
If someone knows what's going on here I would appreciate input on this.
Johnny
(Lucky for me there's more than one way to do it...)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning hash from sub
by duff (Parson) on Dec 05, 2003 at 22:51 UTC | |
|
Re: Returning hash from sub
by delirium (Chaplain) on Dec 06, 2003 at 06:16 UTC | |
|
Re: Returning hash from sub
by tilly (Archbishop) on Dec 06, 2003 at 08:46 UTC | |
by duff (Parson) on Dec 06, 2003 at 17:43 UTC | |
|
Re: Returning hash from sub
by jweed (Chaplain) on Dec 06, 2003 at 06:36 UTC |