1Tie::Hash::NamedCapture(P3eprml)Programmers Reference GTuiied:e:Hash::NamedCapture(3pm)
2
3
4

NAME

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

SYNOPSIS

9           tie my %hash, "Tie::Hash::NamedCapture";
10           # %hash now behaves like %+
11
12           tie my %hash, "Tie::Hash::NamedCapture", all => 1;
13           # %hash now access buffers from regexp in $qr like %-
14

DESCRIPTION

16       This module is used to implement the special hashes "%+" and "%-", but
17       it can be used to tie other variables as you choose.
18
19       When the "all" parameter is provided, then the tied hash elements will
20       be array refs listing the contents of each capture buffer whose name is
21       the same as the associated hash key. If none of these buffers were
22       involved in the match, the contents of that array ref will be as many
23       "undef" values as there are capture buffers with that name. In other
24       words, the tied hash will behave as "%-".
25
26       When the "all" parameter is omitted or false, then the tied hash
27       elements will be the contents of the leftmost defined buffer with the
28       name of the associated hash key. In other words, the tied hash will
29       behave as "%+".
30
31       The keys of "%-"-like hashes correspond to all buffer names found in
32       the regular expression; the keys of "%+"-like hashes list only the
33       names of buffers that have captured (and that are thus associated to
34       defined values).
35
36       This implementation has been moved into the core executable, but you
37       can still load this module for backward compatibility.
38

SEE ALSO

40       perlreapi, re, "Pragmatic Modules" in perlmodlib, "%+" in perlvar, "%-"
41       in perlvar.
42
43
44
45perl v5.34.0                      2021-10-18      Tie::Hash::NamedCapture(3pm)
Impressum