Help for this page

Select Code to Download


  1. or download this
    print for map{ 
        m[(^\d+\s+(?:[\d\.]+\s+){3})(.+$)]
    ...
    65/60**    8,993.0    2,947.2    6,045.7
    49    526.8    264.7    262.2
    and over
    
  2. or download this
    print for grep{
        m[^\d+\s]
    } map{ 
        m[(^\d+\s+(?:[\d\.]+\s+){3})(.+$)]
    } <DATA>;
    
  3. or download this
    print for sort { 
        local $^W; 
    ...
    } map{ 
        m[(^\d+\s+(?:[\d\.]+\s+){3})(.+$)]
    } <DATA>;
    
  4. or download this
    #! perl -slw
    use strict;
    ...
    
    print "Age\tMale\tFemale";
    printf for @trimmed;
    
  5. or download this
    my( $age90line ) = grep{ m[90\s+and\s+over] } @lines;
    $age90line = join "\t", $age90line =~ m[(90\s+and\s+over)\s+\S+\s+(\S+
    +)\s+(\S+)];
    
  6. or download this
    ## And strip out the combined total and add "Age end"
    my @trimmed = map{
        s[(^\d+\s+)[\d\.]+\s+][$1\t$1];
        $_;
    } @sorted;
    
  7. or download this
    print "Age start\tAge end\tMale\tFemale";
    print for @trimmed, $age90line;
    
  8. or download this
    P:\test>501023-2
    Age start       Age end Male    Female
    ...
    88      88    15.2    50.9
    89      89    11.6    40.7
    90 and over     31.8    131.3
    
  9. or download this
    print "Age start\tAge end\tMale\tFemale";
    printf "%s\t\t%s\t\t%s\t\t%s\n", 
        m[(\S+)\s*(\S+)\s+(\S+)\s+(\S+) 
        for @trimmed, $age90line;