Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: data structure question

by roboticus (Canon)
on Aug 30, 2013 at 12:29 UTC ( #1051617=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $alias_line_count       = 0;  # Number of aliases I have
    my @alias_label_array      = ();
    ...
    my @ap_value_array         = ();
    my $ap_line_count          = 0;  # Number of APs I have
    my $ap_person_count        = -1; # Eh? I don't know...
    
  2. or download this
    # Print the data for officer 'Joe'
    for my $i (0 .. $officer_count-1) {
    ...
            print "Joe: $officer_value_array[$i]\n";
        }
    }
    
  3. or download this
    for my $i (0 .. $#officer_label_array) {
        if ($officer_label_array[$i] eq 'Joe') {
            print "Joe: $officer_value_array[$i]\n";
        }
    }
    
  4. or download this
    for my $i (0 .. $#officer_label_value_array) {
        if ($officer_label_value_array[$i][0] eq 'Joe') {
            print "Joe: $officer_label_value_array[$i][1]\n";
        }
    }
    
  5. or download this
    for my $array_reference (@officer_label_value_array) {
        my ($name, $value) = @$array_reference;
        print "$name: $value\n" if $name eq 'Joe';
    }
    
  6. or download this
    my $name = 'Joe';
    print "$name: $officer_hash{$name}\n" if exists $officer_hash{$name};
    
  7. or download this
    my %aliases = {
    #   Name    Title
    ...
    
    # How many officers do we have, anyway?
    print "We have ", scalar(keys %officers), " officers.\n";
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2014-07-12 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (241 votes), past polls