The do builtin will take care of that,
my $data = do $filepath;
$data will hold the last perl value in the file. that is commonly an anonymous hashref within {} braces. The output of Data::Dumper is suitable and often used for this.
| [reply] [d/l] |
How does the subroutine "just includes another file"? Are you using use or require? Or are you opening the file and reading it each time the subroutine is called?
----
I Go Back to Sleep, Now.
OGB
| [reply] [d/l] [select] |
| [reply] [d/l] [select] |
What do you mean, 'your sub just includes another file'?
Do you mean it reads a file into memory, and you want to
reread that file every time in the subroutine? If so, that's easy. Just move the code that reads the file into your sub.
Or do you mean it loads a *module*? If that's the case, you need to do a little more work. You need to tell Perl to forget that it's loaded the module, and then re-use the module;
sub foo {
delete $INC{'My/Cool/Module.pm');
no warnings 'redefined';
require My::Cool::Module;
# etc. etc. etc.
}
And if it's neither of those things, I have no idea what you're trying to do.
--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=>
.q>.<4-KI<l|2$<6%s!<qn#F<>;$,
.=pack'N*',"@{[unpack'C*',$_]
}"for split/</;$_=$,,y[A-Z a-z]
{}cd;print lc
| [reply] [d/l] [select] |
No its just another perl script.
| [reply] |
| [reply] [d/l] |