File: code.pm

package info (click to toggle)
libpod-tree-perl 1.31-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,020 kB
  • sloc: perl: 2,231; exp: 215; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/local/bin/perl

use 5.006;
use strict;
use warnings;

my @entries;
my %entry;

while (<>) {
	/^##/ and next;

	m(^//) and do {
		push @entries, {%entry};
		%entry = ();
		next;
	};

	chomp;
	my ( $key, $val ) = split ' ', $_, 2;

	$key or next;
	$entry{$key} = $val;

}

@entries = sort { $a->{GENOME_SIZE} <=> $b->{GENOME_SIZE} } @entries;

for my $entry (@entries) {
	my @vals = map { $entry->{$_} } qw(COMMON_NAME GENOME_SIZE);
	printf "%-40s %12.f\n", @vals;
}