This snippet joins together the bilingual news on http://www.germnews.de/. And it helps me to study German. Hope it's helpful to you too.

USAGE:
% snippet year month m_day
Thanks
#!/usr/bin/perl use strict; use LWP::Simple; use Regexp::Bind qw(global_bind); my ($year, $mon, $mday) = @ARGV[0..2]; my $template = qr'<A NAME=(?#<number>\d+)>(?#<title>\w.+?)</B><BR><BR> +.+?<table width=75%>\n< tr><td>\n?(?#<text>.+?)\n?(?:<BR>){3}.+?</table>'s; sub url { sprintf("http://www.germnews.de/archive/$_[0]/%4d/%02d/%02d.html", $ +year, $mon, $mday); } sub get_url { [get(url('dn')), get(url('gn'))] } sub regexp_bind { map { my @c; foreach my $t (global_bind($_, $template)){ $c[$t->{number}] = [ $t->{title}, $t->{text} + ]; } \@c; } @{$_[0]} } sub output { my ($a, $b) = @_; <<"."; <NEWS> <TITLE> <EN> $a->[0] </EN> <DE> $b->[0] </DE> </TITLE> <CONTENT> <EN> $a->[1] </EN> <DE> $b->[1] </DE> </CONTENT> </NEWS> . } my($a, $b) = regexp_bind(get_url($year, $mon, $mday)); foreach (0..(@$a >= @$b ? $#$a : $#$b)){ next unless $a->[$_][0] && $b->[$_][0]; print output($a->[$_], $b->[$_]); }

In reply to Bilingual German news aggregator by xern

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.