Help for this page

Select Code to Download


  1. or download this
    sub getTypeName {
        my $typeNum = shift;
    ...
            die "$typeNum not valid\n";
        }
    }
    
  2. or download this
    sub getTypeName {
        my $typeNum = shift;
    ...
    
        return $typeName;
    }
    
  3. or download this
    my $first = substr $line, 0, 2;
    my $second = substr $line, 2, 4;
    my $third = substr $line 10, 4;
    
  4. or download this
    my ($first, $second, $junk, $third) = unpack "A2A4A4A4", $line;
    
  5. or download this
    my ($first, $second, $third) = (unpack "A2A4A4A4", $line)[0,1,3];
    
    # Or, you could do ...
    
    my ($first, $second, $third) = ($line =~ /(.{2})(.{4})(.{4})(.{4})/)[0
    +,1,3];
    
  6. or download this
    my @colNames = qw(first second third);
    my %hash;
    @hash{@colNames) = (unpack "A2A4A4A4", $line)[0,1,3];