in reply to sharing variables among 2 subroutines
The existing subroutine is returning a list of values, and the previous respondent showed you how you can capture that into another list-of my-variables.
Another “way to do it” might be to have the parse_file subroutine return a hash that is then supplied as an input-variable to move_file. The appeal of this approach, to me, is that the order of the elements in a hash does not matter: a hash is a collection of related values that is, by its intrinsic nature, self-describing. If you want to add another value to whatever you want to pass between the two subroutines, you can “just do it.”
So now, your code might be something like...
foreach $file (@filelist) { my $info = Parse::parse_file($file); Moving::move_file($info); }
Remember that the internal comments to both modules ... which of course have been written with them and are scrupulously maintained along with the code ... must include detailed explanations of where the input- and output-hashes come from, and what they are required to contain. The subroutines should also die, and not just “behave incomprehensibly,” if their prerequisites are not met...
Conservatum Follicum: “The hair you save may be your own,” and you just might miss it someday...