Help for this page

Select Code to Download


  1. or download this
    my @claim_records = ();
    while (<CLAIMS>) {
        push(@claim_records, read_record($_));
    }
    
  2. or download this
    ## Put this at the top of your program
    ## This would be much longer in your program.
    ...
        claim_number
        claim_type
    );
    
  3. or download this
    sub read_record {
        my ($line) = @_;
    ...
        @claim_record{ CLAIM_KEYS } = unpack(CLAIM_TEMPLATE, $line);
        return \%claim_record;
    }
    
  4. or download this
    my $sort_by = 'claim_type';
    foreach $record ( sort sub { $a->{$sort_by} cmp $b->{$sort_by} } @clai
    +m_records ) {
         print STDOUT $record->{'claim_number'}, "\n";
    }