Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: Re-orderable keyed access structure?

by BrowserUk (Patriarch)
on Aug 14, 2004 at 14:58 UTC ( [id://382970]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        @actual       %indexOf    @keyFor
    0 [ A_value ]    { A => 0 }   [  A  ]
    ...
    2 [ C_value ]    { C => 2 }   [  C  ]
    3 [ D_value ]    { D => 3 }   [  D  ]
    4 [ E_value ]    { E => 4 }   [  E  ]
    
  2. or download this
    sub getByKey {
        my $key = shift;
    ...
        
        return $value
    }
    
  3. or download this
        @actual       %indexOf    @keyFor
    0 [ C_value ]*   { A => 1 }*  [  C  ]*
    ...
    2 [ B_value ]    { C => 0 }*  [  B  ]*
    3 [ D_value ]    { D => 3 }*  [  D  ]*
    4 [ E_value ]    { E => 4 }*  [  E  ]*
    
  4. or download this
      @keys        %valByKey         %keyByValRef 
    0 [ A ]    { A => \A_value }   { \A_value => A }
    ...
    2 [ C ]    { C => \C_value }   { \C_value => C }
    3 [ D ]    { D => \D_value }   { \D_value => D }
    4 [ E ]    { E => \E_value }   { \E_value => E }
    
  5. or download this
    sub getByKey {
        my $key = shift;
    ...
        
        return $value;
    }
    
  6. or download this
      @keys        %valByKey           %idxByVal
    0 [ A ]    { A => \A_value }   { \A_value => 0 }
    ...
    2 [ C ]    { C => \C_value }   { \C_value => 2 }
    3 [ D ]    { D => \D_value }   { \D_value => 3 }
    4 [ E ]    { E => \E_value }   { \E_value => 4 }
    
  7. or download this
    sub getByKey {
        my $key = shift;
    ...
        
        return $value;
    }
    
  8. or download this
      @keys        %valByKey           %idxByVal
    0 [ C ]    { A => \A_value }   { \A_value => 0 }
    ...
    2 [ B ]    { C => \C_value }   { \C_value => 2 }
    3 [ D ]    { D => \D_value }   { \D_value => 3 }
    4 [ E ]    { E => \E_value }   { \E_value => 4 }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://382970]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-19 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found