Wikipedia:Footnote3/numlink2note.pl

$ref=0;

@urls=();

while ( <> ) {

while ( ($before,$url,$after) = m/(^|.*?[^[])\[([a-z][a-z0-9]+:[^][ ]+)\](.*)/i ) {

$ref++;

print $before, "{{ref|$ref}}";

$_ = $after;

push @urls, $url;

};

print $_;

}

print "\n\n==Notes==\n\n";

print "\n";

$endnote=0;

foreach (@urls) {

$endnote++;

print "# {{note|$endnote}} $_\n";

}

print STDERR "printed $ref references and $endnote endnotes .. should be the same\n";