Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Eval and $@% ...by jeroenes (Priest) |
on Jun 19, 2001 at 01:44 UTC ( [id://89471]=note: print w/replies, xml ) | Need Help?? |
For starters, you probably would like to read perlref, perlreftut link here, perldsc and perltoot.
The eval solution is nice. But I don't see where you get the $type from. Well, if you have a CODE (it's actually a sort of ref) and the functions are garanteed to neglect the input, you could use CODE => '&'. To handle REFs, add: $type = ref( $_[0] ) if $type eq 'REF';, the eval part doesn't change! A GLOB is more problematic. You have to put it into brackets so add an extra if statement:
Hope this helps, Jeroen
In Section
Seekers of Perl Wisdom
|
|