I am working on updating some very old Perl code (not my code) and I came across the following in a subroutine:
sub DoEvent {
local(*eventWEH, $foreachFunc, @args) = @_;
$ret = do $foreachFunc(*eventWEH, @args);
}
This seemed to work fine in Perl 5.6.1 but no longer works in Perl 5.22 which gives a syntax error just after the do $foreachFun(
What is the purpose of the asterisk in front of the variable *eventWEH?
If this were "C" I would suggest some sort of pointer. Any suggestions?
ETA: This sub gets called with lots of different types for the first parameter. For example:
&DoEvent($abc, "DoAbc", @args);
and
&DoEvent(@xyz, "DoXyz", @args);
So as per the answers given, it looks like the *eventWEH can take on a different data type to match whatever parameter is passed to the sub.