He didn't say he wanted to execute it more than once. If he did, we could add one line to your code:
which executes "foo.pl" 10 times.for (1 .. 10) { require "./foo.pl"; delete $INC{ './foo.pl' }; }
So, even had he wanted to do it repeatedly, it's still doable and the OP's question still did not indicate a broken understanding of perl. That's just your assumption.
Update: Some might take Abigail's comment below to mean that the above is somehow incorrect, and worse, because of his reputation they might believe it without first trying it to see for themselves. For those who might be misled:
$ echo 'print@ARGV' > t; $ perl -le 'for ( 1 .. 3 ) { @ARGV = $_; require"t"; delete $INC{"t"} +}' 1 2 3
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Passing a required script arguments
by sauoq
in thread Passing a required script arguments
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |