-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgetrfcs.pl
More file actions
35 lines (29 loc) · 696 Bytes
/
Copy pathgetrfcs.pl
File metadata and controls
35 lines (29 loc) · 696 Bytes
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
34
35
#!/usr/bin/perl -w
my $wikifile = shift || "wikidata.txt";
my $wikidata = {};
if (-f $wikifile) {
$wikidata = read_wiki($wikifile);
}
print "# Source file with RFC Numbers to generate a nice list\n";
print "\n";
foreach my $key (sort {$a <=> $b } keys %$wikidata) {
print "$key\n";
}
exit 0;
sub read_wiki {
my $file = shift;
my %data;
if (open(FH, "<$file")) {
while (<FH>) {
my @bits = split /[|]{2}/, $_;
my $id = $bits[1];
next unless $id =~ m/RFC (\d+)/;
$data{$1} = {
desc => $bits[2],
res => $bits[3],
};
};
close(FH);
}
return \%data;
}