Go to main content

man pages section 3: Library Interfaces and Headers

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

Tie::Hash::NamedCapture (3)

Name

Tie::Hash::NamedCapture - Named regexp capture buffers

Synopsis

tie my %hash, "Tie::Hash::NamedCapture";
# %hash now behaves like %+

tie my %hash, "Tie::Hash::NamedCapture", all => 1;
# %hash now access buffers from regexp in $qr like %-

Description

Perl Programmers Reference Guide
                                                    Tie::Hash::NamedCapture(3)



NAME
       Tie::Hash::NamedCapture - Named regexp capture buffers

SYNOPSIS
           tie my %hash, "Tie::Hash::NamedCapture";
           # %hash now behaves like %+

           tie my %hash, "Tie::Hash::NamedCapture", all => 1;
           # %hash now access buffers from regexp in $qr like %-

DESCRIPTION
       This module is used to implement the special hashes "%+" and "%-", but
       it can be used to tie other variables as you choose.

       When the "all" parameter is provided, then the tied hash elements will
       be array refs listing the contents of each capture buffer whose name is
       the same as the associated hash key. If none of these buffers were
       involved in the match, the contents of that array ref will be as many
       "undef" values as there are capture buffers with that name. In other
       words, the tied hash will behave as "%-".

       When the "all" parameter is omitted or false, then the tied hash
       elements will be the contents of the leftmost defined buffer with the
       name of the associated hash key. In other words, the tied hash will
       behave as "%+".

       The keys of "%-"-like hashes correspond to all buffer names found in
       the regular expression; the keys of "%+"-like hashes list only the
       names of buffers that have captured (and that are thus associated to
       defined values).

       This implementation has been moved into the core executable, but you
       can still load this module for backward compatibility.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+-----------------------+
       |ATTRIBUTE TYPE |   ATTRIBUTE VALUE     |
       +---------------+-----------------------+
       |Availability   | runtime/perl-532      |
       +---------------+-----------------------+
       |Stability      | Pass-through volatile |
       +---------------+-----------------------+

SEE ALSO
       perlreapi, re, "Pragmatic Modules" in perlmodlib, "%+" in perlvar, "%-"
       in perlvar.



NOTES
       Source code for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This software was built from source available at
       https://github.com/oracle/solaris-userland.  The original community
       source was downloaded from
       http://www.cpan.org/src/5.0/perl-5.32.0.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.perl.org/.



perl v5.32.0                      2020-06-14
                                                    Tie::Hash::NamedCapture(3)