This is a an example of [Markdown][1] footer links. I'm trying to use [Perl][2] to organize them more coherently.
But I'm getting too many newlines and I'm hoping the [PerlMonks][3] can help.
[1]: https://daringfireball.net/projects/markdown/
[2]: http://www.perl.org/
[3]: http://www.perlmonks.org/
####
This is a an example of [Markdown][1] footer links. I'm trying to use [Perl][2] to organize them more coherently.
[1]: https://daringfireball.net/projects/markdown/
[2]: http://www.perl.org/
But I'm getting too many newlines and I'm hoping the [PerlMonks][3] can help.
[3]: http://www.perlmonks.org/
####
This is a an example of [Markdown][1] footer links. I'm trying to use [Perl][2] to organize them more coherently.
[1]: https://daringfireball.net/projects/markdown/
[2]: http://www.perl.org/
But I'm getting too many newlines and I'm hoping the [PerlMonks][3] can help.
[3]: http://www.perlmonks.org/
####
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $text;
local $/;
$text = <>;
my @url_list = ($text =~ m/\[.*?\]\:.*/g);
$text =~ s/\s+\[.*?\]\:.*//g;
foreach my $line (split /^/, $text) {
print $line;
foreach ($line =~ m/\[.*?\]\[(.*?)\]/g) {
my $link_number = $_;
print "\n";
print grep(/(\[$link_number\]\:.*)/, @url_list);
print "\n";
}
}