To check if something exists use exists. ;)
use strict; use warnings; require ('Encode.pm'); if (exists &Encode::encode) { print "Exists\n"; } else { print "None such\n"; }
Prints:
Exists
In reply to Re: How to check if a function exists within a package?
by GrandFather
in thread How to check if a function exists within a package?
by rapide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |