or for the web-venturous
#!/usr/bin/perl -T use strict; use warnings; #use diagnostics; use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); # Clean up our UNIX environment # for more infor read perldoc perlsec $ENV{'PATH'} = '/awiopt/radio:/tmp'; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Flush the output buffer $|++; my @text; # shuffle function from List::Util sub shuffle (@) { my @a=\(@_); my $n; my $i=@_; map { $n = rand($i--); (${$a[$n]}, $a[$n] = $a[$i])[0]; } @_; } print header; print start_html(-title=>"Fun with Typoglycemia", -BGCOLOR=>"#cccc99" ), "\n"; print "<tt><center>\n"; print h3("Fun", "With", "Typoglycemia"),"\n"; print "</center>\n"; print hr,"\n"; print "\n\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" wid +th=\"70%\" align=\"center\">\n\n"; print "<tr align=\"center\" bgcolor=\"#999966\">\n <th>Typoglycemic Text</th>\n </tr>\n"; print "<td>\n"; if ( defined (param('TEXT')) ) { # $/=undef; @text=param('TEXT'); for (@text) { my $line = $_; my $line_copy = $line; while ($line =~ m/(\w+)/g) { next if length($1) < 4; my $start_offset = pos($line) - length($1) +1; my $word_middle_length = length($1) - 2; # force two character lead-in and lead-out if ($word_middle_length > 4) { $word_middle_length -= 2; $start_offset++; } my $word_middle = substr($line, $start_offset, $word_middle_le +ngth); my $shuffled_word_middle = join('', shuffle( split(//, $word_m +iddle) ) ); substr($line_copy, $start_offset, $word_middle_length) = $shuf +fled_word_middle; } print "$line_copy\n"; } } print "</td>\n"; print "</table>\n"; print br,br; print "\n\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" wid +th=\"70%\" align=\"center\">\n\n"; print "<tr align=\"center\" bgcolor=\"#999966\">\n <th>Enter your text</th>\n </tr>\n"; print "</table>\n"; print br,br; print start_form; print "<center>\n"; print textarea('TEXT',"", 15, 80), "\n",br; print submit; print end_form; print "</center>\n",br; print "\n\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" hei +ght=\"20\" width=\"70%\" align=\"center\">\n\n"; print "<tr align=\"center\" bgcolor=\"#999966\">\n <td> </td>\n </tr>\n"; print "</table>\n",br; print end_html;

I couldn't resist...
Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

In reply to Re: Typoglycemia Fun by tcf03
in thread Typoglycemia Fun by reasonablekeith

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.