Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tie::hash::namedcapture(3pm) [suse man page]

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

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, "Pragmatic Modules" in perlmodlib, "%+" in perlvar, "%-" in perlvar. perl v5.12.1 2010-04-26 Tie::Hash::NamedCapture(3pm)

Check Out this Related Man Page

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

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, "Pragmatic Modules" in perlmodlib, "%+" in perlvar, "%-" in perlvar. perl v5.16.3 2013-03-04 Tie::Hash::NamedCapture(3pm)
Man Page

15 More Discussions You Might Find Interesting

1. Programming

Compression algorithm( usage of Hash tables)

Hi All, i was browsing thru' the opensource glib(deflate/inflate) algorithms.. which i am supposed to implement. I came across Dictionary usage (Hash tables), LZ77 algorithm and Huffman coding in that.. i couldn't follow on the Hash table implementation in that. Anybody there to give some... (5 Replies)
Discussion started by: rvan
5 Replies

2. Shell Programming and Scripting

perl adding items to a hash

how would you go about taking a user's input and adding it to a hash? i'd also like it to permanently add the input to the hash. not just in the ram, add it into the script! :eek: (17 Replies)
Discussion started by: andrew2325
17 Replies

3. Shell Programming and Scripting

Hash Question in Perl

Learning Perl here, so bear with me... Have a hash that i need to delete the entry out of and am having problems doing that. Basically, I need to delete all entries from the hash that have values over 5,000,000. What I am trying to do is to find each entry and delete it. Does not work - I have... (6 Replies)
Discussion started by: deadletter
6 Replies

4. Shell Programming and Scripting

Perl hashes "Can't use subscript on private hash"

This is driving me mad, where am I going wrong? The relevant segment of code: sub getndsybcons { my @servers=@{$_}; my @sybservers=@{$_}; my %results; foreach my $server(@servers) { my $biggestsyb; my $biggestsybval=0; ... (9 Replies)
Discussion started by: Smiling Dragon
9 Replies

5. Shell Programming and Scripting

Perl Hash if exists

print $hash{$value} if exists $hash{$key}; would only print my top value, and not the one I want to "match".... should i not be using if exists? how would you recommend "searching" a hash file... thanks! (6 Replies)
Discussion started by: yesokay
6 Replies

6. Shell Programming and Scripting

Print is not in ordered after hash converted to array

Perl: Can anyone tell me why after I convert the hash into an array, when I print it out, it's not in the order like the hash? See below.. my %cityZip = ("Logan, AL", 35098, "Los Angeles, CA", 90001, "OrangeVille, IL", 61060, "Palm Bay, FL",... (6 Replies)
Discussion started by: teiji
6 Replies

7. Shell Programming and Scripting

perl using hash

i want to ask is it i can use hash in perl to store a page number with a list of words which is in that page and then print it out? Example Page 1 contains a are boy cat ............. (a list of sorted words) how can i store it in a hash? Thank you (3 Replies)
Discussion started by: mingming88
3 Replies

8. Shell Programming and Scripting

perl hash

Hi i am reading one file and creating Hash from the contents of it my issue is there are 3 different files in 3 different locations having same structure so for parsing these files i have one subroutine which returns hash after reading all the 3 files i need to create consolidated hash from three... (2 Replies)
Discussion started by: zedex
2 Replies

9. Shell Programming and Scripting

PERL - printing a hash of hashes to screen

Hi there I have a hash of hashes made up of the following data bge0|100|half|10.36.100.21 bge1|1000|full|10.36.100.22 bge2|1000|full|10.36.100.23 which when i turn into a hash, would look like this inside the system bge0 -> nic_speed -> 100 nic_duplex -> half ... (6 Replies)
Discussion started by: hcclnoodles
6 Replies

10. Programming

Hash Function Speed

I have created my own hash table class, but am looking to speed it up. My current hash function is: int HashTable::hashFunc(const string &key) const { int tableSize = theLists.size(); int hashVal = 0; for(int i = 0; i<key.length(); i++) hashVal =... (7 Replies)
Discussion started by: killerqb
7 Replies

11. Shell Programming and Scripting

Perl: Any quick way to use regex on hash keys?

Hi, Is there any quick way to use pull out keys that match a specific regex pattern? eg %hash ; $hash(123,456) = xxx; $hash(123,457) = xxx; $hash(123,458) = xxx; $hash(223,459) = xxx; I need a fast way to get all the keys that start with 123.. Meaning I should get ... (5 Replies)
Discussion started by: Leion
5 Replies

12. UNIX for Advanced & Expert Users

Passing Hash variable in to sql query in perl

Hi Everyone, Can anyone help me how do i call hash variable in to sql query in perl. Please see the script below i have defined two Hash %lc and %tab as below $lc{'REFF'}='V_RES_CLASS'; $lc{'CALE'}='V_CAP_CLASS'; $lc{'XRPD'}='V_XFMR_CLASS'; $tab{'V_RES_CLASS'}='V_MFR_SERS';... (6 Replies)
Discussion started by: jam_prasanna
6 Replies

13. Shell Programming and Scripting

perl hash sort

I have a hash as below 'C1' => { 'x' => 41.9 , 'y' => 5.79999999999995} 'c2 288' => { 'x' => 428.05 , 'y' => 5.79999999999995} 'turn' => { 'x' => 493.25 , 'y' => 209.85} '0001' => { 'x' => 530.1 , 'y' => 195.7} '000001' => { 'x' => 235.25 , 'y' => 728.15} 'XYZ' => { 'x' => 56.65 , 'y' =>... (6 Replies)
Discussion started by: chakrapani
6 Replies

14. Programming

Read column into hash

Hi, I want to read the __DATA__ into hashes with the first word (indented) of each part as key and the rest of the part (an array as value). Each part of the input is identified by the indentation. i.e. "The Skipper", "Professor", "Gilligan" are three identifiers as they do not have indentation,... (7 Replies)
Discussion started by: yifangt
7 Replies

15. Shell Programming and Scripting

array of hash - perl

How do I get the unique hashes from an array of hashes? @ar1 = ( {a=>1,b=>2}, {c=>3,d=>4},{a=>1,b=>2});I need : @ar2 = ( {a=>1,b=>2}, {c=>3,d=>4});Thanks. (2 Replies)
Discussion started by: shellwell
2 Replies