Created
May 14, 2014 18:03
-
-
Save mattfenwick/863e000ae013c277d259 to your computer and use it in GitHub Desktop.
examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
local $/; # set slurp mode so that entire file is read at once (instead of a single line) | |
my $content = <STDIN>; | |
my %refs = (); | |
foreach my $key ($content =~ m/\\ref\{([\w_]+)\}/g) { | |
$refs{$key} = 1; | |
} | |
my %labels = (); | |
foreach my $key ($content =~ m/\\label\{([\w_]+)\}/g) { | |
$labels{$key} = 1; | |
} | |
foreach my $ref (keys %refs) { | |
if (!$labels{$ref}) { | |
print "oops, dangling ref: $ref\n"; | |
} | |
} | |
foreach my $label (keys %labels) { | |
if (!$refs{$label}) { | |
print "oops, dangling label: $label\n"; | |
} | |
} | |
print "\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo $@ # all args passed in | |
for name in $@ | |
do | |
echo $name | |
cat $name | perl checkref.pl | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment