in reply to How to check if a function exists within a package?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to check if a function exists within a package?
by ikegami (Patriarch) on Sep 08, 2008 at 01:29 UTC |