For most practical purposes, this question is totally useless. But I have a CPAN module Test-Weaken, which detects leaks in arbitrary Perl data structures. It needs to traffic in references to as many Perl data objects as possible. For all the Perl data types except one, I can duplicate a reference, as follows:
\@{$array_ref} # ARRAY \%{$hash_ref} # HASH \${$scalar_ref} # SCALAR, REF, LVALUE, VSTRING, Regexp \*{$glob_ref) # GLOB, IO, FILEHANDLE \&{$code_ref} # CODE
My question: how do I dup a FORMAT reference?
You can get a format reference with this syntax: $formatref = *foo{FORMAT}. Formats themselves are deprecated and why you'd want a reference to one I don't know, but my purpose is to allow Test::Weaken to be able to deal with whatever data is thrown at it. That data may come from perverse and/or legacy code.
UPDATED: corrected typos.
In reply to How to dereference a FORMAT reference? by Jeffrey Kegler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |