Other than needless duplication, your code is fine. My only concern would be the &subname syntax. When calling a sub with and ampersand prefix and not passing any arguments, the current value of @_ is passed to the sub. This is useful if you are calling subs from subs and need to keep the original passed parameters.foreach $file ($afile, $bfile, $cfile, $dfile) { if (defined $file) { &parse_recent; &parse_monthly; &parse_new; &create_temp_a; ©_new_to_recent; ©_recent_to_monthly; &remove_excess; &done; } }
The danger is, if you're not aware of this and you have something in your @_ array, calling a sub this way may generate unexpected results. You're calling many subs with this syntax and if any of them are doing something unusual if the @_ array is empty, you may have a problem.
Here's an example:
Guess what? It prints "We're having an argument: Good." even though casual examination suggests that no argument was passed. It's safer to call the sub as subname() or simply call it with a bare subname (which I wouldn't suggest as that means you aren't using strict.&sub1("Good"); sub sub1 { &sub2; } sub sub2 { my $var = shift; print "We're having an argument: $var.\n" if defined $var; }
Other than that, nothing more to offer. Give us more detail on your problem and we'll try to help.
Cheers,
Ovid
In reply to (Ovid) Re: is this correct?
by Ovid
in thread is this correct?
by damian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |