I've been doing some work on a colleague's script this morning, adding in some (stand-alone) subroutines that I developed as part of the project as a whole.
This, obviously, was trivial enough, and as the subs had previously been tested, I expected the testing of the overall script to be just as trivial. Interestingly, however, I started getting a run-time error message from Perl, that wasn't picked up using perl -c, or during my own testing of the subroutines:
Now, line 120 is the start of one of my subroutines, which contains a foreach loop, and very little else (see below for code). The loop variable does, in fact, have a $, and this error seemed bizzare, all the more so because this didn't come up during previous testing.Missing $ on loop variable at Script.pl line 120
After some time investigating this, I found that the problem was being caused by the script's shebang line calling a different version of Perl (5.001) to that that I'd done my testing under (5.004.04). If I changed the shebang to call Perl 5.004, the script functioned perfectly happily. Fortunately, running the rest of the script under Perl 5.004 doesn't impact it at all (not that I'd expect it to), and hence we fixed the problem by simply calling the newer version of Perl.
I'm interested to know whether others have experienced problems like this, with multiple versions of Perl being used by the same development team?
If anyone can offer any insights as to why I see the error, at run-time, not at compile-time, I'd be very interested to hear them as well .. :)
sub process_customer_data { my $_cust_data = shift; my %customer_data; foreach my $id (keys %$_cust_data) { # do stuff } return %customer_data; }
-- Foxcub
A friend is someone who can see straight through you, yet still enjoy the view. (Anon)
In reply to Inconsistencies between Perl versions by Tanalis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |