#!/usr/bin/perl =head1 NAME kvread - Vocabulary memorization tool =head1 SYNOPSYS kvread [file name] =head1 DESCRIPTION kvread makes use of a vocabulary files created by KDE FlashKard. This +script shows words from a given file with a translation\ randomly. =head1 AUTHOR bhappy =cut use strict; use warnings; use Tk; use XML::Simple; use Getopt::Long; my $xml_file = shift; my $words = XMLin($xml_file, forcearray => [ qw(e) ], keyattr => [] ); my $mw = Tk::MainWindow->new; # $mw->overrideredirect(1); my ($worde, $wordr) = &rand_n(\@{$words->{e}}); $mw->Label(-textvariable => \$worde, -background => 'pink', -font => ' +verdana')->pack; $mw->Label(-textvariable => \$wordr, -background => 'lightblue')->pack +; $mw->update; $mw->repeat(8*1000, sub{($worde, $wordr) = &rand_n(\@{$words->{e}})}); MainLoop; sub rand_n { my ($words_ref) = @_; my $count = rand @$words_ref; my $worde = $words_ref->[$count]->{o}; my $wordr = $words_ref->[$count]->{t}; return ($worde, $wordr); }

In reply to A simple words memorization tool by bhappy

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.