Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Tie::Hash::NamedCapture

Name Tie::Hash::NamedCapture
Version 0.10
Located at /usr/lib64/perl5
File /usr/lib64/perl5/Tie/Hash/NamedCapture.pm
Is Core Yes
Search CPAN for this module Tie::Hash::NamedCapture
Documentation Tie::Hash::NamedCapture
Module Details Tie::Hash::NamedCapture

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).


SEE ALSO

perlreapi, re, perlmodlib/Pragmatic Modules, perlvar/``%+'', perlvar/``%-''.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024