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...)
In reply to Returning hash from sub by S3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |