1Symbol::Global::Name(3)User Contributed Perl DocumentatioSnymbol::Global::Name(3)
2
3
4
6 Symbol::Global::Name - finds name and type of a global variable
7
9 package My;
10 our $VERSION = '0.1';
11
12 use Symbol::Global::Name;
13 print Symbol::Global::Name->find( \$VERSION );
14
15 # prints '$My::VERSION'
16
18 Lookups symbol table to find an element by reference.
19
21 find
22 Symbol::Global::Name->find( \$VERSION );
23 Symbol::Global::Name->find( \$VERSION, package => 'My::Package' );
24 Symbol::Global::Name->find( reference => \$VERSION );
25 Symbol::Global::Name->find( reference => \$VERSION, package => 'My::Package' );
26
27 Takes a reference and optional package name. Returns name of the
28 referenced variable as long as it's in the package or sub-package and
29 it's a global variable. Returned name is prefixed with type sigil, eg.
30 '$', '@', '%', '&' or '*'.
31
33 Ruslan Zakirov <ruz@bestpractical.com>
34
36 Under the same terms as perl itself.
37
38
39
40perl v5.34.0 2021-07-22 Symbol::Global::Name(3)