perldoc > Tie::Hash::NamedCapture

πŸ“˜ NAME

Tie::Hash::NamedCapture β€” Named regexp capture buffers

πŸš€ Quick Reference

Use CaseCommandDescription
Access named captures from last match (like %+) tie my %hash, "Tie::Hash::NamedCapture"; Ties %hash to behave exactly like %+ β€” only leftmost defined buffers
Access all named captures including unmatched buffers (like %-) tie my %hash, "Tie::Hash::NamedCapture", all => 1; Each value is an array ref of all captures with that name (including undef for unmatched)
Custom variable tied to regexp buffers tie my %hash, "Tie::Hash::NamedCapture", ...; Use the all parameter to switch between %+ and %- behavior

πŸ“‹ 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.

πŸ”— SEE ALSO

Tie::Hash::NamedCapture
πŸ“˜ NAME πŸš€ Quick Reference πŸ“‹ SYNOPSIS πŸ“ DESCRIPTION πŸ”— SEE ALSO

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-22 15:29 @216.73.216.102
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!