<?xml version="1.0" encoding="windows-1252"?>
<node id="358307" title="ambrus's scratchpad" created="2004-06-01 13:41:09" updated="2005-08-12 23:14:29">
<type id="182711">
scratchpad</type>
<author id="295576">
ambrus</author>
<data>
<field name="doctext">
&lt;c&gt;
#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;algorithm&gt;
#include "opencv2/core/core.hpp"




using std::cerr; using std::abort;
using std::min; using std::max;


/*! Find a point set in a mask that is nearest (in l^\infty metric) to a given point. */
/*!
	\arg `image` is a boolean mask, must be of type `CV_8C` and 2 dimensional, 
		nonzero value means true.
	
	\arg `center` is the point.
	
	\arg `output` becomes the nearest point found.

	\returns true iff a point is found, false if `image` is all false.
*/
bool
FindNearestPoint(cv::Mat image, cv::Point center, cv::Point &amp;output) {
	if (CV_8U != image.type() || 2 != image.dims) {
		cerr &lt;&lt; "error: wrong type of matrix passed to FindNearestPoints (type=" &lt;&lt; image.type() &lt;&lt; ", dims=" &lt;&lt; image.dims &lt;&lt; ").\n";
		abort();
	}
	int sy = image.rows, sx = image.cols;
	int cy = center.y, cx = center.x;
	int ldx = cx &lt; 0 ? -cx : sx &lt;= cx ? cx - sx : 0;
	int ldy = cy &lt; 0 ? -cy : sy &lt;= cy ? cy - sy : 0;
	int ld = max(ldx, ldy);
	int hdx = cx &lt; 0 ? sx - cx : sx &lt;= cx ? cx : max(cx, sx - cx);
	int hdy = cy &lt; 0 ? sy - cy : sy &lt;= cy ? cy : max(cy, sy - cy);
	int hd = max(hdx, hdy);
	for (int d = ld; d &lt;= hd; d++) {
		int ay = cy - d;
		int ly = max(0, ay);
		int by = cy + d;
		int hy = min(sy - 1, by);
		int ax = cx - d;
		int lx = max(0, ax);
		int bx = cx + d;
		int hx = min(sx - 1, bx);
		if (0 &lt;= ax &amp;&amp; ax &lt; sx)
			for (int y = ly; y &lt;= hy; y++)
				if (0 != image.at&lt;unsigned char&gt;(y, ax))
					{ output = cv::Point(ax, y); return true; }
		if (0 &lt;= bx &amp;&amp; bx &lt; sx)
			for (int y = ly; y &lt;= hy; y++)
				if (0 != image.at&lt;unsigned char&gt;(y, bx))
					{ output = cv::Point(bx, y); return true; }
		if (0 &lt;= ay &amp;&amp; ay &lt; sy)
			for (int x = lx; x &lt;= hx; x++)
				if (0 != image.at&lt;unsigned char&gt;(ay, x))
					{ output = cv::Point(x, ay); return true; }
		if (0 &lt;= by &amp;&amp; by &lt; sy)
			for (int x = lx; x &lt;= hx; x++)
				if (0 != image.at&lt;unsigned char&gt;(by, x))
					{ output = cv::Point(x, by); return true; }
	}
	output = cv::Point(0, 0);
	return false;
}


&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
For obfu. The following magic variables intify automatically: &lt;c&gt;$- $= $% $? $! $^E $^F $^T $^D $^H $^P&lt;/c&gt;.  The following stringify: &lt;c&gt;$0 $^I $^O $\ $^A $:&lt;/c&gt;.  This boolify: &lt;c&gt;$| $^W $^C&lt;/c&gt;.
&lt;hr&gt;
&lt;p&gt;
To Monk_perl:
&lt;code&gt;
203527 &lt;+termbot&gt; +bcc vowel.c
203529 &lt;+termbot&gt; -Borland C++  Version 3.1 Copyright (c) 1992 Borland 
                  International
203529 &lt;+termbot&gt; -vowel.c:
203529 &lt;+termbot&gt; -Error vowel.c 9: Type mismatch in parameter '__s' in call to 
                  'fgets' in function main
203529 &lt;+termbot&gt; -Error vowel.c 9: Too few parameters in call to 'fgets' in 
                  function main
203529 &lt;+termbot&gt; -Error vowel.c 9: Nonportable pointer conversion in function 
                  main
203529 &lt;+termbot&gt; -Warning vowel.c 18: Unreachable code in function main
203529 &lt;+termbot&gt; -Error vowel.c 20: Compound statement missing } in function 
                  main
203531 &lt;+termbot&gt; -Warning vowel.c 20: Function should return a value in 
                  function main
203534 &lt;+termbot&gt; -*** 4 errors in Compile ***
203534 &lt;+termbot&gt; -*** 4 errors in Compile ***
203534 &lt;+termbot&gt; -
203535 &lt;+termbot&gt; -        Available memory 4081880
203536 &lt;+termbot&gt; -
203537 &lt;+termbot&gt; -C:\MONKPERL&gt;
203542 &lt;@b_jonas&gt; `type vowel.c
203542 &lt;+termbot&gt; +type vowel.c
203542 &lt;+termbot&gt; - #include&lt;stdio.h&gt;
203542 &lt;+termbot&gt; -#include&lt;conio.h&gt;
203542 &lt;+termbot&gt; - main()
203542 &lt;+termbot&gt; - {
203543 &lt;+termbot&gt; -   char c;
203545 &lt;+termbot&gt; -   int i,n=0;  /* n stands for no. of vowel*/
203547 &lt;+termbot&gt; - clrscr();
203548 &lt;+termbot&gt; -    c=fgets(a[i]);
203549 &lt;+termbot&gt; -       for(i=0;i&lt;=a[i];i++)
203550 &lt;+termbot&gt; -    {
203551 &lt;+termbot&gt; -      switch(c)
203552 &lt;+termbot&gt; -         {
203554 &lt;+termbot&gt; -          case 'a': case 'e': case 'i': case 'o': case 'u':
203555 &lt;+termbot&gt; -           n++;
203556 &lt;+termbot&gt; -           break;
203557 &lt;+termbot&gt; -
203558 &lt;+termbot&gt; -          getch();
203559 &lt;+termbot&gt; - }
203600 &lt;+termbot&gt; - }
203600 &lt;+termbot&gt; -
203601 &lt;+termbot&gt; -C:\MONKPERL&gt;
&lt;/c&gt;
&lt;p&gt;
Let's fix the call to fgets.
&lt;c&gt;
203945 &lt;@b_jonas&gt; `edlin vowel.c
203945 &lt;+termbot&gt; +edlin vowel.c
203946 &lt;+termbot&gt; -End of input file
203946 &lt;+termbot&gt; -*
204002 &lt;@b_jonas&gt; 9
204005 &lt;@b_jonas&gt; `9
204005 &lt;+termbot&gt; +9
204006 &lt;+termbot&gt; -       9:*    c=fgets(a[i]);
204006 &lt;+termbot&gt; -       9:*
204017 &lt;@b_jonas&gt; ` fgets(a, 9, stdin);
204017 &lt;+termbot&gt; + fgets(a, 9, stdin);
204017 &lt;+termbot&gt; -*
204023 &lt;@b_jonas&gt; `8,10p
204023 &lt;+termbot&gt; +8,10p
204023 &lt;+termbot&gt; -       8:  clrscr();
204023 &lt;+termbot&gt; -       9:  fgets(a, 9, stdin);
204023 &lt;+termbot&gt; -      10:*       for(i=0;i&lt;=a[i];i++)
204023 &lt;+termbot&gt; -*
204030 &lt;@b_jonas&gt; `e
204031 &lt;+termbot&gt; +e
204031 &lt;+termbot&gt; -
204031 &lt;+termbot&gt; -C:\MONKPERL&gt;
204039 &lt;@b_jonas&gt; `bcc vowel.c
204039 &lt;+termbot&gt; +bcc vowel.c
204041 &lt;+termbot&gt; -Borland C++  Version 3.1 Copyright (c) 1992 Borland 
                  International
204041 &lt;+termbot&gt; -vowel.c:
204042 &lt;+termbot&gt; -Warning vowel.c 18: Unreachable code in function main
204042 &lt;+termbot&gt; -Error vowel.c 20: Compound statement missing } in function 
                  main
204042 &lt;+termbot&gt; -Warning vowel.c 20: Function should return a value in 
                  function main
204042 &lt;+termbot&gt; -*** 1 errors in Compile ***
204042 &lt;+termbot&gt; -
204042 &lt;+termbot&gt; -        Available memory 4081880
204044 &lt;+termbot&gt; -
204044 &lt;+termbot&gt; -C:\MONKPERL&gt;

204406 &lt;@cbstream&gt; [ambrus] ah, that one error I got seems to be a mistake when 
                   I copied the program. I skipped a line. So what did you get? 
                   What does the program do for you?

204132 &lt;@b_jonas&gt; `edlin vowel.c
204132 &lt;+termbot&gt; +edlin vowel.c
204132 &lt;+termbot&gt; -End of input file
204132 &lt;+termbot&gt; -*
204405 &lt;@b_jonas&gt; `17
204406 &lt;+termbot&gt; +17
204406 &lt;+termbot&gt; -      17:*
204406 &lt;+termbot&gt; -      17:*
204407 &lt;@b_jonas&gt; ` }
204407 &lt;+termbot&gt; + }
204407 &lt;+termbot&gt; -*
204409 &lt;@b_jonas&gt; `e
204410 &lt;+termbot&gt; +e
204410 &lt;+termbot&gt; -
204410 &lt;+termbot&gt; -C:\MONKPERL&gt;
204412 &lt;@b_jonas&gt; `bcc vowel.c
204412 &lt;+termbot&gt; +bcc vowel.c
204415 &lt;+termbot&gt; -Borland C++  Version 3.1 Copyright (c) 1992 Borland 
                  International
204415 &lt;+termbot&gt; -vowel.c:
204415 &lt;+termbot&gt; -Warning vowel.c 20: Function should return a value in 
                  function main
204415 &lt;+termbot&gt; -Turbo Link  Version 5.1 Copyright (c) 1992 Borland 
                  International
204415 &lt;+termbot&gt; -
204415 &lt;+termbot&gt; -        Available memory 4075304
204418 &lt;+termbot&gt; -
204418 &lt;+termbot&gt; -C:\MONKPERL&gt;

204640 &lt;@cbstream&gt; [ambrus] Monk_perl: apart from the wrong condition in the 
                   for loop, I think there are at least two smaller problems: 
                   first, you never output anything, secondly, you call getch() 
                   too many times (once for each iteration in the for loop)

204645 &lt;+termbot&gt; -C:\MONKPERL&gt;
204656 &lt;@b_jonas&gt; `edlin vowel.c
204657 &lt;+termbot&gt; +edlin vowel.c
204657 &lt;+termbot&gt; -End of input file
204657 &lt;+termbot&gt; -*
204704 &lt;@b_jonas&gt; `18d
204704 &lt;+termbot&gt; +18d
204704 &lt;+termbot&gt; -*
204724 &lt;+termbot&gt; -*
204815 &lt;@b_jonas&gt; `19i
204815 &lt;+termbot&gt; +19i
204815 &lt;+termbot&gt; -      19:*
204841 &lt;@b_jonas&gt; `printf("%d",n);
204841 &lt;+termbot&gt; +printf("%d",n);
204841 &lt;+termbot&gt; -      20:*
204844 &lt;@b_jonas&gt; ``o
204844 &lt;+termbot&gt; +^Z
204845 &lt;+termbot&gt; -*
204849 &lt;@b_jonas&gt; `17p
204849 &lt;+termbot&gt; +17p
204849 &lt;+termbot&gt; -      17:  }
204849 &lt;+termbot&gt; -      18:  }
204849 &lt;+termbot&gt; -      19: printf("%d",n);
204849 &lt;+termbot&gt; -      20:* }
204850 &lt;+termbot&gt; -*
204853 &lt;@b_jonas&gt; `10
204854 &lt;+termbot&gt; +10
204854 &lt;+termbot&gt; -      10:*       for(i=0;i&lt;=a[i];i++)
204854 &lt;+termbot&gt; -      10:*
204926 &lt;@b_jonas&gt; `  for (i = 0; 0 != a[i]; i++)
204926 &lt;+termbot&gt; +  for (i = 0; 0 != a[i]; i++)
204926 &lt;+termbot&gt; -*
204933 &lt;@b_jonas&gt; `1p
204934 &lt;+termbot&gt; +1p
204934 &lt;+termbot&gt; -       1:  #include&lt;stdio.h&gt;
204934 &lt;+termbot&gt; -       2: #include&lt;conio.h&gt;
204934 &lt;+termbot&gt; -       3:  main()
204934 &lt;+termbot&gt; -       4:  {
204934 &lt;+termbot&gt; -       5:    char c;
204934 &lt;+termbot&gt; -       6:     char a[9];
204935 &lt;+termbot&gt; -       7:    int i,n=0;  /* n stands for no. of vowel*/
204935 &lt;+termbot&gt; -       8:  clrscr();
204936 &lt;+termbot&gt; -       9:  fgets(a, 9, stdin);
204936 &lt;+termbot&gt; -      10:   for (i = 0; 0 != a[i]; i++)
204937 &lt;+termbot&gt; -      11:     {
204937 &lt;+termbot&gt; -      12:       switch(c)
204938 &lt;+termbot&gt; -      13:          {
204938 &lt;+termbot&gt; -      14:           case 'a': case 'e': case 'i': case 'o': 
                  case 'u':
204939 &lt;+termbot&gt; -      15:            n++;
204939 &lt;+termbot&gt; -      16:            break;
204940 &lt;+termbot&gt; -      17:  }
204940 &lt;+termbot&gt; -      18:  }
204942 &lt;+termbot&gt; -      19: printf("%d",n);
204943 &lt;+termbot&gt; -      20:* }
204943 &lt;+termbot&gt; -*
205017 &lt;@b_jonas&gt; `e
205017 &lt;+termbot&gt; +e
205017 &lt;+termbot&gt; -
205018 &lt;+termbot&gt; -C:\MONKPERL&gt;
205025 &lt;@b_jonas&gt; `bcc vowel.c
205025 &lt;+termbot&gt; +bcc vowel.c
205028 &lt;+termbot&gt; -Borland C++  Version 3.1 Copyright (c) 1992 Borland 
                  International
205028 &lt;+termbot&gt; -vowel.c:
205028 &lt;+termbot&gt; -Warning vowel.c 20: Function should return a value in 
                  function main
205028 &lt;+termbot&gt; -Turbo Link  Version 5.1 Copyright (c) 1992 Borland 
                  International
205028 &lt;+termbot&gt; -
205028 &lt;+termbot&gt; -        Available memory 4074540
205031 &lt;+termbot&gt; -
205031 &lt;+termbot&gt; -C:\MONKPERL&gt;

205320 &lt;@cbstream&gt; [ambrus] right, the problem is, &lt;c&gt;switch(c)&lt;/c&gt; doesn't 
                   make sense, since you only assign &lt;c&gt;c&lt;/c&gt; once and in a 
                   wrong way at that time. you need to switch on something 
                   that's set to the next character each time.

205319 &lt;@b_jonas&gt; `edlin vowel.c
205320 &lt;+termbot&gt; +edlin vowel.c
205320 &lt;+termbot&gt; -End of input file
205320 &lt;+termbot&gt; -*
205352 &lt;@b_jonas&gt; `12
205352 &lt;+termbot&gt; +12
205352 &lt;+termbot&gt; -      12:*      switch(c)
205352 &lt;+termbot&gt; -      12:*
205401 &lt;@b_jonas&gt; `    switch(a[i])
205401 &lt;+termbot&gt; +    switch(a[i])
205401 &lt;+termbot&gt; -*
205403 &lt;@b_jonas&gt; `e
205403 &lt;+termbot&gt; +e
205403 &lt;+termbot&gt; -
205403 &lt;+termbot&gt; -C:\MONKPERL&gt;
205406 &lt;@b_jonas&gt; `bcc vowel.c
205406 &lt;+termbot&gt; +bcc vowel.c
205408 &lt;+termbot&gt; -Borland C++  Version 3.1 Copyright (c) 1992 Borland 
                  International
205408 &lt;+termbot&gt; -vowel.c:
205408 &lt;+termbot&gt; -Warning vowel.c 20: Function should return a value in 
                  function main
205408 &lt;+termbot&gt; -Turbo Link  Version 5.1 Copyright (c) 1992 Borland 
                  International
205409 &lt;+termbot&gt; -
205409 &lt;+termbot&gt; -        Available memory 4074540
205411 &lt;+termbot&gt; -
205411 &lt;+termbot&gt; -C:\MONKPERL&gt;
205417 &lt;@b_jonas&gt; `vowel
205418 &lt;+termbot&gt; +vowel
205420 &lt;@b_jonas&gt; `semi
205420 &lt;+termbot&gt; -semi
205420 &lt;+termbot&gt; -2
205420 &lt;+termbot&gt; -C:\MONKPERL&gt;
205422 &lt;@b_jonas&gt; `vowel
205422 &lt;+termbot&gt; +vowel
205427 &lt;@b_jonas&gt; eieio
205431 &lt;@b_jonas&gt; `eieio
205432 &lt;+termbot&gt; -eieio
205432 &lt;+termbot&gt; -5
205432 &lt;+termbot&gt; -C:\MONKPERL&gt;
205433 &lt;@b_jonas&gt; `vowel
205433 &lt;+termbot&gt; +vowel
205447 &lt;@b_jonas&gt; strmpf
205453 &lt;@b_jonas&gt; `strmpf
205454 &lt;+termbot&gt; -strmpf
205454 &lt;+termbot&gt; -0
205454 &lt;+termbot&gt; -C:\MONKPERL&gt;

205523 &lt;@cbstream&gt; [ambrus] ah, after all the modifications, my version seems 
                   to work now.

205646 &lt;@b_jonas&gt; `type vowel.c
205646 &lt;+termbot&gt; +type vowel.c
205646 &lt;+termbot&gt; - #include&lt;stdio.h&gt;
205646 &lt;+termbot&gt; -#include&lt;conio.h&gt;
205646 &lt;+termbot&gt; - main()
205646 &lt;+termbot&gt; - {
205647 &lt;+termbot&gt; -   char c;
205647 &lt;+termbot&gt; -    char a[9];
205648 &lt;+termbot&gt; -   int i,n=0;  /* n stands for no. of vowel*/
205648 &lt;+termbot&gt; - clrscr();
205649 &lt;+termbot&gt; - fgets(a, 9, stdin);
205649 &lt;+termbot&gt; -  for (i = 0; 0 != a[i]; i++)
205650 &lt;+termbot&gt; -    {
205650 &lt;+termbot&gt; -    switch(a[i])
205651 &lt;+termbot&gt; -         {
205651 &lt;+termbot&gt; -          case 'a': case 'e': case 'i': case 'o': case 'u':
205652 &lt;+termbot&gt; -           n++;
205652 &lt;+termbot&gt; -           break;
205653 &lt;+termbot&gt; - }
205653 &lt;+termbot&gt; - }
205654 &lt;+termbot&gt; -printf("%d",n);
205654 &lt;+termbot&gt; - }
205655 &lt;+termbot&gt; -
205655 &lt;+termbot&gt; -C:\MONKPERL&gt;
&lt;/code&gt;


&lt;hr&gt;
&lt;p&gt;
To [Xiong]: 
&lt;c&gt;
use warnings;
use Scalar::Util "blessed";

{
package Error::Base;
sub new {
	my($class, $str, @rest) = @_;
	my %o = (str =&gt; $str, @rest); # you may store backtrace info too
	bless \%o, $class;
}
use overload q/""/ =&gt; "strify";
sub strify {
	my($self) = @_;
	$$self{str} . "\n"; # you may append a user-readable form of the backtrace
}
sub crash {
	my($self, @rest) = @_;
	die $self-&gt;new(@rest);
}
}

my $wt = -140;
if ($wt &lt; 0) {
	Error::Base-&gt;crash("creature weight negative", 
		negative_creature_weight =&gt; 1, 
		creature_name =&gt; "dragon",
		creature_weight =&gt; -140,
	);
}

__END__
&lt;/c&gt;
Output:
&lt;c&gt;
creature weight negative
&lt;/c&gt;
&lt;hr&gt;
To Monk_perl:
&lt;ol&gt;
&lt;li&gt;
Solve [id://927735].
&lt;li&gt;
Write a C program that inputs a list of fourteen integers separated by whitespace, then prints their alternating sign sum.  
&lt;p&gt;Example input: &lt;c&gt;44 57 31 29 51 29 59 48 82 18 95 11 45 64&lt;/c&gt;.  Output for this input: &lt;c&gt;151&lt;/c&gt;
&lt;li&gt;
Without running it on a computer, determine what this program would print if ran.
&lt;c&gt;
#include &lt;stdio.h&gt;
int main(void) {
    int n = 0;
    while (n &lt; 10) {
        if (n &lt; 5) { 
            n = n + 3; 
        } else { 
            n = n + 2; 
            printf("%d\n", n); 
        }
    }
    return 0;
}
&lt;/c&gt;
&lt;/ol&gt;
&lt;hr&gt;
List of perl modules I have, for [Xiong].  This is  inclusive like your list, there are some modules in here that I haven't really tried.  
&lt;p&gt;
Some dependencies are not listed, even if I've used them directly.  Also, assume that I mean the latest stable versions of each of these modules and of the perl core.
&lt;ul&gt;
&lt;li&gt;
Mark Lehmann's modules: AnyEvent, EV, AnyEvent::HTTP, Coro, Compress::LZF, EV::Loop::Async, JSON::XS, EV::ADNS, IO::Socket::SSL, AnyEvent::HTTP.  (If you want to be inclusive, just install all his modules :)
&lt;li&gt;
Email parsing and creation: Mime::Tools, Email::Mime.
&lt;li&gt;
Internationalization stuff: Unicode::Collate.
&lt;li&gt;
modules whose functions have been integrated to core lately but you can still use them if you want your code to run on older perls unchanged: Socket::GetAddrInfo, MRO::Compat, Hash::Util::FieldHash::Compat, WWW::Curl.
&lt;li&gt;
OS interface: BSD::Resource, Socket::MsgHdr.
&lt;li&gt;
Date module: Date::Manip.
&lt;li&gt;
Toolkit stuff: Glib, Gtk2, Wx, Tk.
&lt;Li&gt;
web and XML and related stuff: CGI, HTML::Tree, XML::Twig, XML::LibXML, XML::XSH2, XML::XPath, LWP, URI, Net::Curl::Simple, Mozilla::CA.
&lt;li&gt;
Perl data structures stuff: Data::Diver, Data::Dump::Streamer.
&lt;li&gt;
Perl internals magic stuff: Sub::Name.
&lt;li&gt;
Regexp::Common.
&lt;li&gt;
Numeric: Math::BigInt::GMP, Math::Int64, Math::Libm, PDL.
&lt;li&gt;
Serialization: YAML (I don't recommend this one, but it's popular), YAML::Syck, JSON.
&lt;li&gt;
Various other modules I have downloaded to look at their docs but have never used them and possibly never even installed them (this is true to some of the previous modules too): Astro::MoonPhase, B::Keywords, File::HomeDir, File::ShareDir, Sane.
&lt;li&gt;
Paul Evan's modules (I haven't really tried any of these): Async-MergePoint, IO::Async, AnyEvent::IRC, Term::TermKey.
&lt;li&gt;
(Update:) This one I install only because I'm the maintainer: Object::Import.
&lt;/ul&gt;

&lt;hr&gt;
&lt;p&gt;
Code in pre tags around code tags
&lt;pre&gt;
&lt;c&gt;
first line
second
third
fourth
&lt;/c&gt;
&lt;/pre&gt;

&lt;hr&gt;

Poll idea draft
&lt;p&gt;
I can't imagine how I could live all my childhood without: mobile phone, electric toothbrush, el. pencil sharpener, notebook computer, Euro, smartphone, wireless mouse, dishwasher, .
&lt;p&gt;

&lt;hr&gt;

To [cythin], based on [id://885390] and [id://827649]:
&lt;c&gt;
use warnings; use strict;

my $regex1 = qr/([a-zA-Z]+(\d*)+)|((\d*)+[a-zA-Z]+)/;		#default words, and words with numbers
my $regex2 = qr/(\w|\d|\.)+@(\w|\d|\.)+/;			#email addresses
my $regex3 = qr/(\w+)\s?(\d)+/;					#word and number combinations: Number 1, Assignment 2, Vol 	
my $regex4 = qr/(\w+)'(\w){0,2}/;				#contractions in English
my $regex5 = qr/(\w)(\/|&amp;)(\w)/;				#abbreviations with slash: c/o, i/o, etc.
my $regex6 = qr/(M).{1,2}\.(\s([A-Z]{1}[a-z]+))?/;		#formal titles: Dr., Mr., Mrs. Agenstein, etc.
my $regex7 = qr/(\w+)-(\w+)(-\w+)?/;				#hyphenated words: cat-like, face-to-face, etc.
my $regex8 = qr/([A-Z]\.?){3}/;					#3-letter abbreviations, using uppercase only, no space, 
my $regex9 = qr/[a-zA-Z]{3}\.\s?(\d+)/;				#3-letter abbreviations containing numbers, mixed case, 
my $regex10 = qr/\$\d+/;					#money expressions $xxxx format
my $regex11 = qr/\$\d+(.\d{2})?/;				#money expressions $xxxx.xx format
my $regex12 = qr/(http:\/\/.*)|(w{3}\.(.)*)/;			#websites beginning with www. or http://
my $regex13 = qr/(\(\d{3}\)\s(\d{3})-(\d{4}))/;			#phone numbers, no country code (xxx) xxx-xxxx

my @regarray = ($regex13, $regex12, $regex11, $regex10, $regex9, $regex8, $regex7, $regex6, $regex5, $regex4, $regex3, $regex2, $regex1);

$/ = undef;
my $text = &lt;DATA&gt;;

TOK: while(1) {
	for my $i (0 .. @regarray-1) {
		my $re = $regarray[$i];
		if ($text =~ /\G($re)/gc) {
			my $word = $1;
			if (12 != $i) {
				printf "%02d (%s)\n", $i, $word;
			}
			next TOK;
		}
	}
	if ($text =~ /\G./gcs) {
		1;
	} elsif ($text =~ /\G\z/gc) {
		print "end of text\n";
		last;
	} else {
		die;
	}
}

__DATA__
Some text here
&lt;/c&gt;

&lt;hr&gt;
&lt;p&gt;
Custom CSS I use with the Dark theme.  This is grey on black text.  One problem with it is that I can't change the colors of the checkboxes and option buttons, so they look ugly.  (I'm using various versions of Firefox mostly.)
&lt;c&gt;
/* css for ambrus in perlmonks.com */
/* color, supplementing the Dark theme */
input, textarea, select { background-color: #000000; color: #cccccc }
input[type="submit"] { background-color: #000000; color: #ffffff }
a:link { color: #8080ff }
a:visited { color: #a060d0 }
/* posts */
div.notetext { font-size: 100% }
tr.reply-body ul.indent font[size="2"] { font-size: 100% }
div.readmore { background-color: transparent; padding-left: 2px; border-left-width: 2px; border-left-color: #080; border-left-style: solid }
/* nodelets */
tbody.nodelet td { font-size: 100%; background-color: #000000 }
#XP_Nodelet sup { vertical-align: text-top }
tbody.nodelet .inline-list &gt; li:before { content: " "; }
tbody.nodelet#Find_Nodes .inline-list &gt; li { display: block; }
.nodelet#Leftovers ul#external { display: none; }
/* cb messages */
tbody.nodelet td.highlight { /* background-color: transparent */ }
tr.cb_msg td, tr.cb_me td { padding: 0px; text-indent: -0.6em; padding-left: 0.6em; }
/* cb speakers: */
span.chat span.cb_author *:link, span.chat span.cb_author *:visited { font-size: 111% }
span.chat i &gt; span.cb_author *:link , span.chat i &gt; span.cb_author *:visited { font-size: 111%; font-style: italic }
/* cb separators
span.chat span.cb_author:before { content: "\3d" }
span.chat i &gt; span.cb_author:before { content: "\3d" }
span.chat span.cb_author:after { content: "\3d" }
span.chat i &gt; span.cb_author:after { content: "" }
*/
span.chat span.cb_sq_br:first-child , span.chat  span.cb_sq_br , span.chat span.cb_me_bullet   { display: none }
/* span.chat span.cb_sep { } */
/* cb sidebar */
body#id-481185 input[name="message"] { width: 100%; }
body#id-481181 table.cb_table td { font-size: 17px }
/* increase some text areas */
*.user-settings textarea[name="setstyle"] { width: 80ex; height: 20em }
/* show levels next to attributions */
/*.attribution-title { display: inline; }*/
/* misc */
div.ss-criteria-summary { display: none }
/* TEMP */
/*"http://cruft.de/lr.css"*/
/*tbody[id="XP_Nodelet"] { display: none; color: lime }*/
/*.nnt-line-incidental .nnt-link { background-color: orange; }*/
/*ul ul ul { padding-left: 0px }*/
/* body#id-11911 .nodelets { display: none } */
&lt;/c&gt;
Rat gradient is &lt;c&gt;80ff80;8080ff&lt;/c&gt;.

&lt;hr&gt;
&lt;p&gt;
Testing: ea ια ou &amp;#337;&amp;#369; low control &#x2401;&#x2405;&#x241f;&#x240b;&#x240c; space control 

	 del  cp1252  invalid byte &amp;#145;&amp;#128; end.
&lt;hr&gt;
&lt;p&gt;
Languages in order of portability on unix systems, for when I want to write a cross-language obfu.  (These are off the top of my head, check package lists of distros if you want to be sure.)
&lt;ul&gt;
&lt;li&gt;
Almost all unixen: bash or ksh, sed or awk, gcc.
&lt;li&gt;
Almost all linuxen: bash, gsed, gawk, perl.
&lt;li&gt;
Linuxen where you build: g++, gmake.
&lt;li&gt;
Linuxen where you develop: m4 (autotools uses it), lex, yacc, makeinfo, some C libraries.
&lt;li&gt;
Traditional unices (but not some modern linux desktops): make, dc, bc, ex.
&lt;li&gt;
Many unices where you typeset: metafont, tex, latex, gs (ghostscript).
&lt;li&gt;
Many linuxes: python2, ruby1.8, firefox or konqueror.
&lt;/ul&gt;

&lt;hr&gt;
&lt;h3&gt;
Possible rumours about the unohly opwer.
&lt;/h3&gt;
&lt;p&gt;
&lt;b&gt;
I've removed the actual list, because [jdporter] started the service..&lt;/b&gt;
&lt;p&gt;
We may want to cycle these so a new random rumour appears every day on the group page.
&lt;p&gt;
Special thanks to [ww] for some of the ideas.  

&lt;p&gt;
Guidelines for inclusion: (yes, I know, these contradict each other and the list of quips I gave)
&lt;ul&gt;
&lt;li&gt;
No Chuck Norris facts
&lt;li&gt;
Plausible ones, so that if someone casually visits the node only on one day, he probably doesn't get too suspicious.
&lt;li&gt;
Ones that won't make a casual onlooker outraged because of violation of their privacy or other pertained rights if they take the quip seriously, eg. no "can read your private messages".
&lt;li&gt;
No powers that specific Cabal groups (other than gods) have.
&lt;li&gt;
Be vague
&lt;li&gt;
Some un&amp;#x68;oly tone
&lt;li&gt;
Funny
&lt;/ul&gt;

&lt;p&gt;
Template and list removed

&lt;p&gt;
The following are to consider whether they can be added.
&lt;ul&gt;
&lt;li&gt;
edit the lists of top of page quips and xp quips and silence messages and borgisms and un&amp;#x68;oly &amp;#x70;ower rumours
&lt;li&gt;
to edit theme CSS
&lt;li&gt;
Fermat joke
&lt;li&gt;
[id://506825|Microbrewery]
&lt;/ul&gt;



&lt;hr&gt;
Funny warning syntax that inlines to nothing:
&lt;c&gt;
use warnings; use strict;                                                      
no warnings qw"void";                                                          
sub DEBUG () {}            
{ package Dbglt; use overload "&lt;", sub {}; }
*&lt; = sub { bless {}, Dbglt::; };

# for not debugging, uncomment:
sub dbg () { "" } 

# for debugging, uncomment:
#sub dbg { "" }

dbg &amp; &lt;&lt;'DEBUG;';
warn "debugging message";
DEBUG;
warn "normal message";
__END__
&lt;/c&gt;
&lt;hr&gt;
&lt;c&gt;
# bash functions for manipulating the path

shopt -s extglob

# addpath appends a directory to the path unless it is already there
# eg: addpath ~/bin
addpath(){ 
local a p=":$PATH:"; for a; 
do case "$p" in (*:"${a%/}"?(/):*);; (*) p="$p$a:";; esac; 
done; p="${p#:}"; PATH="${p%:}"; 
}

# delpath deletes a dir from the path
delpath(){ 
local a p=":$PATH:"; for a; 
do a="${a%/}"; p=${p/:"${a}"?(\/):/:}; 
done; p="${p#:}"; PATH="${p%:}"; 
}

#END
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
To Xiong: removing filter by calling unimport works as expected:
&lt;c&gt;
[am]king ~/a/tmp$ cat a.pl
{ 
package Filter::Transcript;
use Filter::Util::Call;
sub filter {
	my $s = filter_read;
	warn "TRANSCRIPT: $_";
	$s;
}
sub import {
	filter_add(\&amp;filter); 
}
sub unimport {
	filter_del()
}
BEGIN { $INC{"Filter/Transcript.pm"}++; }
}

print "hello, world\n";

use Filter::Transcript;

for (0, 1) {
	print "this part of the code is transscribed\n";
}

no Filter::Transcript;

print "good bye\n";

__END__
[am]king ~/a/tmp$ perl a.pl
TRANSCRIPT: 
TRANSCRIPT: for (0, 1) {
TRANSCRIPT: 	print "this part of the code is transscribed\n";
TRANSCRIPT: }
TRANSCRIPT: 
TRANSCRIPT: no Filter::Transcript;
hello, world
this part of the code is transscribed
this part of the code is transscribed
good bye
[am]king ~/a/tmp$ perl -v

This is perl 5, version 12, subversion 1 (v5.12.1) built for x86_64-linux

Copyright 1987-2010, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

[am]king ~/a/tmp$ 
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
The link from the internationalized About Google page
[http://www.google.hu/intl/hu/about.html] to the [http://googleblog.blogspot.com/|Google Blog] is
broken.  It says "Google Blog" but actually points to the google
search main page [http://www.google.com/].
&lt;p&gt;
I can't figure out where to send a report about this. 
I looked at the Google Help Center at first,
but in [http://www.google.com/support/bin/static.py?page=portal_more.cs]
I couldn't find a category that matched the about page.  Then I tried
the "Contacting Us" page, but it seems there's no general contact
page, only ones tied to each google product like Web search
([http://www.google.com/support/websearch/bin/request.py?contact_type=contact_policy]),
which sent me to the Help forum.  However, the Help forum
[http://www.google.com/support/forum?hl=en] is also separated to pages
for each google product, and it seems there's no generic forum about
topics that don't fit elsewhere, nor a forum about the Help Center or
the Help forum itself (nor a Help Center category about the forum
etc), so now I completely don't have any idea on who to ask.
&lt;p&gt;
On the
[http://googleblog.blogspot.com/|Google Blog] page itself they say "We Love Feedback" with an email addres, and they're probably interested in the link pointing to them (so readers can find the blog), so finally I sent a mail to that address in case they can help, but I still don't think that's the right place.
&lt;p&gt;
So, dear monks, help me figure out who I should ask about this thing.
&lt;hr&gt;

&lt;p&gt;
Why am I getting this warning?
&lt;c&gt;
$ perl -we 'my %rule = ("suffix1", "foo", "succ1", "bar"); warn join("/", @rule{qw"suffix1 succ1"})'
Scalar value @rule{qw"suffix1 succ1"} better written as $rule{qw"suffix1 succ1"} at -e line 1.
foo/bar at -e line 1.
$ perl -v

This is perl, v5.10.1 (*) built for x86_64-linux

...
&lt;/c&gt;

&lt;hr&gt;

&lt;p&gt;
Word ladder, [http://perl.plover.com/qotw/|perl quiz of the week] expert edition week 22.  See
[http://perl.plover.com/~alias/list.cgi?mss:99:dlfkjbmmdljnajmfagki|report of solutions and task specification], [http://perl.plover.com/~alias/list.cgi?1:mss:2055:nakbjdbklffolpbgdoac|my submission],
and other mails in these two mailing lists.

&lt;hr&gt;

&lt;p&gt;
&lt;b&gt;RE [id://796576]&lt;/b&gt;

&lt;p&gt;
There's 
[id://510925] which links to an older node [id://52469].
&lt;p&gt;
Then there's the amazing [http://sed.sourceforge.net/grabbag/scripts/dc_overview.htm|dc.sed] script which implements arbitrary precision numeric calculations in decimal base in sed &amp;#x2013; you can find [http://sed.sourceforge.net/grabbag/scripts/dc.sed|its source here] or inside the tarball of [http://www.gnu.org/software/sed//sed.html|gnu sed] as a test.  I don't really understand how it does the multiplication and division, but I could do the addittion on my own in a slightly more complicated way in [id://388399] (it's a loop of four substitutions, dc.sed has two and the teasing comment "could be done in one s/// if we could have &gt;9 back-refs..." which I don't really believe).
&lt;p&gt;
How about fibonacci numbers?  Some snipets like [id://715421] use regex substitutions but then they're not really using the power of the regex engine.  There must be some way to actually use the regular expression engine to generate fibonacci numbers though.  Searching yields [id://424865] and [id://98691].  These test for fibonacci numbers rather than generating them but there's probably some way to convert them.  Another idea is to use something like this but probably there's some nicer way to phrase it:
&lt;c&gt;
perl -le'$==1,(1x$_)=~/(^)(1|11\1)*(?{$=++})^/,print$=for 0..20'
&lt;/c&gt;


&lt;hr&gt;
&lt;p&gt;
good &lt;a name="glt" href="javascript: (function(g) { g.parentNode.replaceChild( document.createTextNode( &amp;#x5b;'morning','afternoon','evening']&amp;#x5b;Math.floor(3*Math.random())] ), g ); }( document.getElementsByName('glt')[0] )) "&gt;localtime&lt;/a&gt;
&lt;hr&gt;
&lt;p&gt;
Here's some code to show that IO::Socket inherits the creation methods (new, new_from_fd, fdopen) from IO::Handle.
&lt;c&gt;
perl -we 'use warnings; use strict; use 5.010; use IO "Socket"; use Socket; use Fcntl; my($L, $R) = IO::Socket-&gt;socketpair(PF_UNIX, SOCK_STREAM, 0) or die; $L-&gt;fcntl(F_SETFD, $L-&gt;fcntl(F_GETFD, 0) &amp;~ FD_CLOEXEC); defined(my $p = fork) or die "fork"; if (!$p) { exec @ARGV, $L-&gt;fileno; die "exec"; } $L-&gt;close; print "reading... "; my $x = $R-&gt;getline; say "got: $x"; 0 &lt; waitpid $p,0 or die "wait";' perl -we 'use warnings; use strict; use 5.010; use IO::Socket; sleep 1; my $h = shift; say "fileno: $h"; my $O = IO::Socket-&gt;new_from_fd($h, "&gt;") or die "fdopen $!"; $O-&gt;printflush("hello"); $O-&gt;shutdown(SHUT_WR); say "written"; sleep 1; say "done";'
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
To Tanktalus, who is lazy to read the irc RFCs.
&lt;c&gt;
perl -we 'use Socket; use IO::Handle; socket $C, PF_INET(), SOCK_STREAM(), 0 or die; connect $C, sockaddr_in(6667, inet_aton("irc.freenode.net")) or die; printf $C "user 0 0 0 x\nnick cbu%04x\njoin #cbstream\n", rand(2**16) or die; flush $C; while (&lt;$C&gt;) { y/\r//; /\A(?::\S+)?\s+(?:4|ERROR)/ and die $_; /\A:cbstream!\S+\s+PRIVMSG\s+#cbstream\s+:?(.*)/si and print $1; }'
&lt;/c&gt;
New, corrected version:
&lt;c&gt;
perl -we 'use Socket; use IO::Handle; socket $C, PF_INET(), SOCK_STREAM(), 0 or die; connect $C, sockaddr_in(6667, inet_aton("irc.freenode.net")) or die; printf $C "user 0 0 0 x\nnick cbu%04x\njoin #cbstream\n", rand(2**16) or die; flush $C; while (&lt;$C&gt;) { y/\r//; /\A(?::\S+)?\s+(?:4(?!77)|ERROR)/ and die $_; /\A:cbstream!\S+\s+PRIVMSG\s+#cbstream\s+:?(.*)/si and print $1; }'
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
Numerology.  If you don't cheat by using random operations and only add the letters of each verse then 442 is the most frequent sum in the [http://www.lolcatbible.com/index.php?title=Main_Page|bible].
&lt;c&gt;
   442  thorns(19+7+14+17+13+18) also(0+11+18+14) An(0+13) thistlez(19+7+8+18+19+11+4+25) gun(6+20+13) it(8+19) brin(1+17+8+13) forth(5+14+17+19+7) 2 u(20);  -- Genesis 3:18
   442  Ceiling(2+4+8+11+8+13+6) Cat(2+0+19) sed(18+4+3), "yr(24+17) her(7+4+17) bukkit(1+20+10+10+8+19) holder(7+14+11+3+4+17), go(6+14) hold(7+14+11+3) her(7+4+17) bukkit(1+20+10+10+8+19)." -- Genesis 16:9
   442  An(0+13) he(7+4) sed(18+4+3) "Abraham(0+1+17+0+7+0+12) ur(20+17) gud(6+20+3) kitteh(10+8+19+19+4+7). U(20) wud(22+20+3) givd(6+8+21+3) me(12+4) ur(20+17) kitteh(10+8+19+19+4+7). -- Genesis 22:16
   442  Dad(3+0+3) may(12+0+24) feels(5+4+4+11+18) my(12+24) no(13+14) furz(5+20+17+25), then(19+7+4+13) he(7+4) would(22+14+20+11+3) cockmongle(2+14+2+10+12+14+13+6+11+4) me(12+4)." -- Genesis 27:12
   442  Da(3+0) maidz(12+0+8+3+25) n(13) dere(3+4+17+4) kittehs(10+8+19+19+4+7+18) come(2+14+12+4) up(20+15) and(0+13+3) smelled(18+12+4+11+11+4+3) Esau's(4+18+0+20+18) butt(1+20+19+19), -- Genesis 33:6
   442  newai(13+4+22+0+8) u(20) can(2+0+13) lookz(11+14+14+10+25) at(0+19) me(12+4) An(0+13) seez(18+4+4+25) taht(19+0+7+19) i(8) iz(8+25) ur(20+17) bro(1+17+14). 4 rael(17+0+4+11). -- Genesis 45:12
   442  See(18+4+4)? U(20) has(7+0+18) stopped(18+19+14+15+15+4+3) all(0+11+11) teh(19+4+7) Israelite(8+18+17+0+4+11+8+19+4) d(3)00dz(3+25) from(5+17+14+12) work(22+14+17+10)." -- Exodus 5:5
   442  Eech(4+4+2+7) yr(24+17), U(20) eet(4+4+19) bred(1+17+4+3) wid(22+8+3) no(13+14) yeest(24+4+4+18+19), or(14+17) I(8) pwn(15+22+13) U(20). Big(1+8+6) tyme(19+24+12+4). -- Exodus 12:15
   442  pwn(15+22+13) teh(19+4+7) Midianites(12+8+3+8+0+13+8+19+4+18) for(5+14+17) teh(19+4+7) j(9)00s(18) so(18+14) tehy(19+4+7+24) wil(22+8+11) laik(11+0+8+10) u(20). -- Numbers 31:2
   442  Ruth(17+20+19+7) goes(6+14+4+18) home(7+14+12+4) at(0+19) 5. She(18+7+4) has(7+0+18) got(6+14+19) good(6+14+14+3) amount(0+12+14+20+13+19) of(14+5) foods(5+14+14+3+18). -- Ruth 2:17
   442  "when(22+7+4+13) tehy(19+4+7+24) iz(8+25) liek(11+8+4+10) 'we(22+4) can(2+0+13) haz(7+0+25) cheezburgr(2+7+4+4+25+1+20+17+6+17) naow(13+0+14+22) plz(15+11+25)?'() -- Job 38:40
   442  Oh(14+7) hai(7+0+8). Dude(3+20+3+4) called(2+0+11+11+4+3) Job(9+14+1) replied(17+4+15+11+8+4+3) on(14+13) chat(2+7+0+19) and(0+13+3) sed(18+4+3) back(1+0+2+10) to(19+14) Invisible(8+13+21+8+18+8+1+11+4) Man(12+0+13): -- Job 42:1
   442  u(20) is(8+18) on(14+13) teh(19+4+7) thrones(19+7+17+14+13+4+18), gettin(6+4+19+19+8+13) praised(15+17+0+8+18+4+3) by(1+24) teh(19+4+7) Israel(8+18+17+0+4+11). -- Psalm 22:3
   442  Ceiling(2+4+8+11+8+13+6) cat(2+0+19) are(0+17+4) serious(18+4+17+8+14+20+18) cat(2+0+19). This(19+7+8+18) are(0+17+4) serious(18+4+17+8+14+20+18) psalm(15+18+0+11+12). -- Psalm 24:8
&lt;/c&gt;
&lt;p&gt;
The numerology guys are: [id://701899] [id://714469] [id://629053].
&lt;hr&gt;

&lt;hr&gt;
&lt;p&gt;
New fav pentomino pattern testing here.
&lt;TABLE border="5" cellspacing="0"&gt;
&lt;COLGROUP span="10" width="25"&gt;&lt;/COLGROUP&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#8000c0" colspan="2"&gt;&lt;TD bgcolor="#ffff81" colspan="5"&gt;&lt;TD bgcolor="#40ff40" colspan="3"&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#8000c0" colspan="1"&gt;&lt;TD bgcolor="#80c000" colspan="3"&gt;&lt;TD bgcolor="#4040ff" colspan="4"&gt;&lt;TD bgcolor="#0080c0" colspan="1"&gt;&lt;TD bgcolor="#40ff40" colspan="1"&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#8000c0" colspan="1"&gt;&lt;TD bgcolor="#00c080" colspan="2"&gt;&lt;TD bgcolor="#80c000" colspan="2"&gt;&lt;TD bgcolor="#4040ff" colspan="1"&gt;&lt;TD bgcolor="#0080c0" colspan="3"&gt;&lt;TD bgcolor="#40ff40" colspan="1"&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#8000c0" colspan="1"&gt;&lt;TD bgcolor="#81ffff" colspan="1"&gt;&lt;TD bgcolor="#00c080" colspan="2"&gt;&lt;TD bgcolor="#c00080" colspan="1"&gt;&lt;TD bgcolor="#ff4040" colspan="1"&gt;&lt;TD bgcolor="#0080c0" colspan="1"&gt;&lt;TD bgcolor="#ff81ff" colspan="1"&gt;&lt;TD bgcolor="#c08000" colspan="2"&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#81ffff" colspan="2"&gt;&lt;TD bgcolor="#00c080" colspan="1"&gt;&lt;TD bgcolor="#c00080" colspan="2"&gt;&lt;TD bgcolor="#ff4040" colspan="1"&gt;&lt;TD bgcolor="#ff81ff" colspan="3"&gt;&lt;TD bgcolor="#c08000" colspan="1"&gt;
&lt;TR height="25"&gt;&lt;TD bgcolor="#81ffff" colspan="2"&gt;&lt;TD bgcolor="#c00080" colspan="2"&gt;&lt;TD bgcolor="#ff4040" colspan="3"&gt;&lt;TD bgcolor="#ff81ff" colspan="1"&gt;&lt;TD bgcolor="#c08000" colspan="2"&gt;
&lt;/TABLE&gt;

&lt;hr&gt;
&lt;p&gt;
This is a test to see if we can still make a homenode button with html filtering, using javascript.
&lt;P&gt;
&lt;a name=O href="javascript:d=document;m=d.getElementById('talkbox'); m.value='\x3ca name=O href=\x22'+d.getElementsByName('O')[0].href.replace(/Go(\d+)/,function(x,y){return'Go'+ ++y})+'\x22\x3eGo1';m.parentNode.hubmit();"&gt;Go0
&lt;/a&gt;&lt;/a&gt;&lt;/a&gt;
&lt;p&gt;
&lt;a href="javascript:alert(1)"&gt;Alert1&lt;/a&gt;
&lt;a href="javascript:d=document;d.write('\x3cform method=postImessage name=opI\'ho hum\' name=message '.replace(/I/g,' \x3cinput value='));d.close();d.forms[0].submit();"&gt;Golf
&lt;/a&gt;&lt;/a&gt;
&lt;a href="javascript:d=document;d.body.innerHTML=('\x3cform method=postImessage name=opI\'ho hum\' name=message '.replace(/I/g,' \x3cinput value='));d.forms[0].submit();"&gt;More
&lt;/a&gt;
&lt;a name=O href="javascript:d=document;m=d.getElementById('talkbox'); m.value='\x3ca name=O href=\x22'+d.getElementsByName('O')[0].href+'\x22\x3eO';m.parentNode.hubmit();"&gt;Ofill
&lt;/a&gt;
&lt;a name=O1 href="javascript:void(document.getElementsByName('O1')[0].innerHTML='\x3cimg src=http://tinyurl.com/52jsn3\x3e')" &gt;Smile&lt;/a&gt;
&lt;p&gt;
&lt;a href="r=javascript:r='replace';eval(s='\';d=document;d.write(\'\\x3cform method=postImessage name=opI\\\'H\\\' name=message \'.replace(/I/g,\' \\x3cinput value=\'));d.close();d.forms[0].stubmit();'[r](/^/,'r=\''+r))"&gt;X
&lt;/a&gt;
&lt;p&gt;
&lt;table border=0 cellspacing=0 cellpadding=0&gt;
&lt;COLGROUP span=2 width=2&gt;&lt;/COLGROUP&gt;
&lt;COLGROUP span=1&gt;&lt;/COLGROUP&gt;
&lt;COLGROUP span=1 width=2&gt;&lt;/COLGROUP&gt;
&lt;tr height=1&gt;
&lt;td bgcolor="#f3f3f3" colspan=5&gt;
&lt;tr height=1&gt;
&lt;td bgcolor="#f3f3f3" colspan=4&gt;&lt;td bgcolor="#787878" rowspan=4&gt;
&lt;tr&gt;
&lt;td bgcolor="#f3f3f3" colspan=2&gt;&lt;td bgcolor="#dadada"
&gt;&lt;a href="javasc&amp;#x72;ipt:d=document;d.write('z \x3cform method=post I129 name=node_id Imessage name=op Iwassup name=message '.replace(/I/g,' \x3cinput type=hidden value=')); d.close(); d.forms[0].submit(); " &gt;&lt;font color="#000000"&gt;&amp;nbsp;do not press&amp;nbsp;&lt;/font&gt;&lt;/a&gt;&lt;
td bgcolor="#787878"&gt;
&lt;tr height=1&gt;
&lt;td bgcolor="#f3f3f3" colspan=1&gt;&lt;td bgcolor="#787878" colspan=4&gt;
&lt;tr height=1&gt;
&lt;td bgcolor="#787878" colspan=5&gt;
&lt;/table&gt;

&lt;hr&gt;

&lt;p&gt;
My perlmonks user CSS (I use the default theme, updated 2008 August 1st):
&lt;c&gt;
/* css for ambrus in perlmonks.com */
/* general */
/* posts */
div.notetext { font-size: 100% }
tr.reply-body ul.indent font[size="2"] { font-size: 100% }
div.readmore { background-color: transparent; padding-left: 2px; border-left-width: 2px; border-left-color: #080; border-left-style: solid }
/* nodelets */
#nodelet_body_row_XP_Nodelet sup { vertical-align: text-top }
tbody.nodelet td { font-size: 100% }
/* cb messages */
tbody.nodelet td.highlight { /* background-color: transparent */ }
tr.cb_msg td, tr.cb_me td { padding: 0px; text-indent: -0.6em; padding-left: 0.6em; }
/* cb speakers: */
span.chat span.cb_author *:link, span.chat span.cb_author *:visited { font-size: 111% }
span.chat i &gt; span.cb_author *:link , span.chat i &gt; span.cb_author *:visited { font-size: 111%; font-style: italic }
/* cb separators
span.chat span.cb_author:before { content: "\3d" }
span.chat i &gt; span.cb_author:before { content: "\3d" }
span.chat span.cb_author:after { content: "\3d" }
span.chat i &gt; span.cb_author:after { content: "" }
*/
span.chat span.cb_sq_br:first-child , span.chat  span.cb_sq_br , span.chat span.cb_me_bullet   { display: none }
/* span.chat span.cb_sep { } */
/* cb sidebar */
body#id-481185 input[name="message"] { width: 100%; }
body#id-481181 table.cb_table td { font-size: 17px }
/* increase some text areas */
*.user-settings textarea[name="setstyle"] { width: 80ex; height: 20em }
/* hide levels next to attributions */
span.attribution-title { display: none }
/* misc */
div.ss-criteria-summary { background-color: lime }
/* hide some links from the nodelets */
.nodelet#leftovers a[href="http://www.cafepress.com/perlmonks,perlmonks_too,pm_more"], .nodelet#leftovers a[href="http://www.cafepress.com/perlmonks,perlmonks_too,pm_more"] + br, a[href="http://perlbuzz.com/"], .nodelet#leftovers a[href="http://perlbuzz.com/"] + br, a[href="http://perl.com/"], .nodelet#leftovers a[href="http://perl.com/"] + br, a[href="http://www.perlfoundation.org/perl5/index.cgi"], .nodelet#leftovers a[href="http://www.perlfoundation.org/perl5/index.cgi"] + br, a[href="http://jobs.perl.org/"], .nodelet#leftovers a[href="http://jobs.perl.org/"] + br, a[href="http://www.pm.org/"], .nodelet#leftovers a[href="http://www.pm.org/"] + br, a[href="http://planet.perl.org/"], .nodelet#leftovers a[href="http://planet.perl.org/"] + br, a[href="http://use.perl.org/"], .nodelet#leftovers a[href="http://use.perl.org/"] + br, a[href="http://www.perl.org/"], .nodelet#leftovers a[href="http://www.perl.org/"] + br { display: none }
/* TEMP */
/*"http://cruft.de/lr.css"*/
/*tbody[id="XP_Nodelet"] { display: none; color: lime }*/

&lt;/c&gt;

&lt;hr&gt;
&lt;p&gt;
Variant of [patchy patterns]
&lt;c&gt;
perl -we '($H,$W)=`stty size`=~/^(\d+) (\d+)/?($1-1,$2):(24,80);$w=$W+20; @a = map { rand() &lt; 1/5 } 0 .. ($H+20)*$w; print "\e[H\e[J"; while() { print "\e[H"; for (1..5) { rand(40)&lt;1 and @a[rand(@a)] = 1; @a = map { $c = $_; $s = 0; $s += $a[($c + $_) % @a] for -$w-1, -$w, -$w+1, -1, 1, $w-1, $w, $w+1; $p = $a[$_]; ($p?2:4) &lt;= $s &amp;&amp; $s &lt; ($p?6:9) } 0 .. @a - 1; } for $y (10 .. $H + 9) { for $x (10 .. $W + 9) { print $a[$y*$w + $x] ? "#" : " "; } print "\n"; } }'
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
List of candidates for irc/pm questions that could be auto-replied to.
&lt;ul&gt;
&lt;li&gt;duping filehandles
&lt;li&gt;system versus qx, especially `mkdir` and `cp`
&lt;li&gt;replace between
&lt;li&gt;fork, esp 0==$pid
&lt;li&gt;\Q
&lt;li&gt;dereferencing deep datastructures (hard)
&lt;li&gt;symbolic references
&lt;li&gt;status gauge in a CGI
&lt;li&gt;anything with xp in pmdiscuss
&lt;li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;
Proof-of-concept example for array automatically computing the sum of its first few elements.  On [Limbic~Region]'s question.  Warning: splicing, shifting etc the element will mess this up.
&lt;c&gt;
[am]king ~$ perl -we 'use strict; { package S; use Tie::Scalar; @{*ISA} = "Tie::StdScalar"; sub STORE { $::sum -= ${$_[0]}||0; $::sum += ${$_[0]} = $_[1] } } my @x; tie $x[$_], "S" for 0..2; $::sum = 0; $x[rand(10)] = int(rand(10)) for 0..99; $"="+"; warn "$::sum = @x[0..2]";'
13 = 2+8+3 at -e line 1.
[am]king ~$ 
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
Here's a simple vector paint program.
&lt;p&gt;
It requires a terminal that can do xterm-like mouse reporting.  It allows to draw colored polygons.  
&lt;p&gt;
Left button adds a new node after the last one, right button removes the last node, middle button moves last node.  The dot and comma keys cycle the nodes of the polygon, so you can change the nodes at any place.  Backspace scrapes the whole polygon.  The digits 0-7 set the color of the polygon.  The lc letters a-z select another polygon: you have 26 of these, you can edit and color each of them independently, at startup the "a" polygon is selected, and the polygons with later letters are above the earlier ones.
&lt;p&gt;
The program can now save drawings.  If you give a filename as a command-line argument, the drawing from that file will be loaded (if the file exists) and control-D will quit from the program saving to that file.  
&lt;p&gt; 
You figure out the rest from the code.
&lt;c&gt;
#!ruby -w
# simple vector-based paint program -- by ambrus
#

def mainloop;
	at_exit do
		print "\e[?9l\e[m";
		system(*%w"stty sane");
	end;
	system(*%w"stty -icanon -echo -echonl");
	puts "\e[?9h";
	render;
	while c = STDIN.getc;
		if ?\e != c;
			gotkey c;
		elsif ?[ != STDIN.getc || ?M != STDIN.getc;
		else
			b = STDIN.getc - ?\ ;
			x = STDIN.getc - ?!;
			y = STDIN.getc - ?!;
			gotmouse b, x, y;
		end;
	end;
end;

def render;
	print "\e[H";
	@SCRHEI.times do |y| 
		b = [[1e6]];
		(0 ... @x.size).each do |obj|
			px = @x[obj];
			py = @y[obj];
			b.concat((0 ... px.size).map do |k| 
				m = if py[k-1] &lt;= y &amp;&amp; y &lt; py[k]; 1; 
					elsif py[k] &lt;= y &amp;&amp; y &lt; py[k-1]; -1; end; 
				if m;
					if xdet = py[k] - py[k - 1];
						x = (px[k-1] * (py[k] - y) - px[k] * (py[k - 1] - y)) / xdet; 
						[x, m, obj]; 
					end;
				end;
			end.compact); 
		end;
		b.sort!;
		c = @x.map { 0 }; 
		@SCRWID.times do |x| 
			while b[0][0] &lt; x; 
				c[b[0][2]] += b[0][1]; 
				b.shift;
			end; 
			fobj = (0 ... c.size).map.reverse!.find {|o| 0 != c[o] };
			colr = if fobj; @colr[fobj] else "7" end;
			print "\e[4#{colr}m ";
		end; 
		y &lt; @SCRHEI - 1 and print "\e[K\n"; 
	end;
	print "\e[J";
	STDOUT.flush;
end;

def fsave fname;
	File.open(fname, "w") do |file|
		file.puts "DRAWIMAGE 0 1";
		(0 ... 26).each do |n|
			@x[n].empty? and next;
			file.print "OBJECT ", n, " ", @colr[n];
			(0 ... @x[n].size).each do |k|
				file.print " ", @x[n][k], " ", @y[n][k];
			end;
			file.print "\n";
		end;
	end;
end;
def fload fname;
	file = ();
	begin
		file = File.open(fname);
	rescue Errno::ENOENT, Errno::ENAMETOOLONG, Errno::EISDIR, Errno::ELOOP, Errno::ENOTDIR, 
		Errno::EACCES, Errno::EROFS;
		return;
	end;
	version = false;
	file.each do |l|
		l =~ /\A\s*(?:#|\z)/ and next;
		f = l.scan(/\S+/);
		case f[0].upcase;
			when "DRAWIMAGE";
				"0" == f[1] or fail "wrong major verson loading image file";
				version = true;
			when "OBJECT";
				(0 ... 26) === (n = Integer(f[1])) or fail "wrong file format: invalid obj nr";
				(0 ... 7) === (colr = Integer(f[2])) or fail "wrong file format: invalid colr";
				@colr[n] = colr.to_s;
				s = (f.size - 3)/2;
				(0 ... s).each do |k|
					(-32768 .. 32767) === (@x[n][k] = Integer(f[3 + k * 2])) or fail "wrong file format: invalid coordinate";
					(-32768 .. 32767) === (@y[n][k] = Integer(f[3 + k * 2 + 1])) or fail "wrong file format: invalid coordinate";
				end;
			when "QC";
				# noop
			else
				fail "wrong file format: invalid decl";
		end;
	end;
	version or fail "wrong draw file format: no header";
	file.close;
	true;
end;

TIOCGWINSZ = 0x00005413;
def getwinsz;
	#@SCRHEI, @SCRWID = 24, 80;
	STDOUT.ioctl(TIOCGWINSZ, (buf = [].pack("x99")));
	@SCRHEI, @SCRWID = buf.unpack("s!s!");
end;
getwinsz;

@x = (0 ... 26).map { [] };
@y = @x.map { [] };
@colr = @x.map { "0" };
def selobj n;
	@s = n;
	@xs = @x[n];
	@ys = @y[n];
end;
selobj 0;
$*.empty? or fload($*[0]);

def gotmouse b, x, y;
	if 0 == b; # left button appends point
		@xs.push x;
		@ys.push y;
	elsif 2 === b; # right button removes point
		@xs.pop;
		@ys.pop;
	elsif 1 === b; # middle button moves last point
		@xs.empty? and return;
		@xs[@xs.size - 1] = x;
		@ys[@xs.size - 1] = y;
	end;
	render;
end;
def gotkey c;
	case c;
		when ?a .. ?z;
			selobj c - ?a;
		when ?0 .. ?7;
			@colr[@s] = c.chr;
		when ?\b, ?\x7f;
			@xs.replace [];
			@ys.replace [];
		when ?,;
			@xs.empty? and return;
			@xs.unshift @xs.pop;
			@ys.unshift @ys.pop;
		when ?.;
			@xs.empty? and return;
			@xs.push @xs.shift;
			@ys.push @ys.shift;
		when ?/;
			@xs.pop;
			@ys.pop;
		when ?\cd;
			$*.empty? or fsave($*[0]);
			exit;
	end;
	render;
end;

mainloop();

__END__

&lt;/c&gt;
Here's an elephant I've made with a previous version.
&lt;c&gt;
                                  +                                             
                 +++++++++++++++++++                                            
                 +++++++++++++++++++++                                          
                 ++++++++++++++++++++++                                         
                 ++++++++++++++++++++++++                                       
                +++++++++    ++++++++++++++++++++++++++++++++++++++++           
                ++++++++++    +++++++++++++++++++++++++++++++++++++++           
                ++++++++++++++++++++++++++++++++++++++++++++++++++++++          
               +++++++++++++++++++++++++++++++++++++++++++++++++++++++          
               +++++++    +++++++++++++++++++++++++++++++++++++++++++++         
               +++++++++++++++++++++++++++++++++++++++++++++++++++++++++        
              ++++++         +++++++++++++++++++++++++++++++++++++++++++        
              +++++         +++++++++++++++++++++++++++++++++++++++++++++       
              ++++         ++++++++++++++++++++++++++++++++++++++++++++++       
             ++++         +++++++++++++++++++++++++++++++++++++++++++++ ++      
          ++++++         ++++++++++++++++++++++++++++++++++++++++++++++  ++     
      ++++++++++         +++++++++++                         ++++++++++   +     
  +++++++               +++++++++++                          ++++++++++    +    
                       ++++++++++++                          ++++++++++         
                      ++++++++++++                           ++++++++++         
                     +++++++++++++                           ++++++++++         

&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
[http://www.math.bme.hu/~ambrus/pu/cbstream/|cbstream FAQ]
&lt;hr&gt;
&lt;p&gt;
To [Corion].
&lt;c&gt;
sub mask {
        my($s, $m) = @_;
        [map { $$s[$_] } grep { 0 != ($m &amp; (1&lt;&lt;$_)) } 0 .. @$s - 1];
}
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
A lua japh.
&lt;c&gt;
a="for b=2,26 do c=0;for d,e in ipairs({a:byte(1,-1)})do c=(b*c+e)%127\
end;io.write(string.char(c))end--$S`U$-}OPX41,@aYH\3\26Q2\23*|&gt;";
loadstring(a)    {ambrus}
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
Question about the regexp engine.
&lt;p&gt;
Suppose I want to do this: &lt;c&gt;"aaaaaaaaab" =~ /(a(?:|(?1)|a(?1 )))/&lt;/c&gt;
&lt;p&gt;
Which one of the below two behaiviours would it do:
&lt;c&gt;
#!perl
# simulate the regexp /(a(?:|(?1)|a(?1)))/
use warnings; 
use strict;
for my $MEM (0, 1) { 
        print $MEM ? "with" : "without", " memoization\n"; 
        my $u;
        my %c = (); 
        my $f; $f = sub { 
                $u++; 
                my $a = join(",", @_); 
                $MEM and exists($c{$a}) and 
                        return $c{$a}; 
                $c{$a} = (
                        1 &lt;= @_ and
                        $_[0] eq "a" and (
                                1 == @_ or
                                &amp;$f(@_[1 .. @_ - 1]) or 
                                $_[1] eq "a" and 
                                        &amp;$f(@_[1 .. @_ - 1])
                        )
                );
        }; 
        for my $s ("aaaaaaaa", "aaaaaaaab") { 
                $u = 0;
                print "  ", $s, ": ",
                        &amp;$f($s =~ /(.)/g) ? "hit" : "miss", ", sub called ", $u, 
" times\n"; 
        } 
}
__END__
&lt;/c&gt;
Output:
&lt;c&gt;
without memoization
  aaaaaaaa: hit, sub called 8 times
  aaaaaaaab: miss, sub called 383 times
with memoization
  aaaaaaaa: hit, sub called 8 times
  aaaaaaaab: miss, sub called 16 times
&lt;/c&gt;
&lt;p&gt;&lt;a name="node_358307_t833837"&gt;
Here's a somewhat similar re that would blow up but perl optimizes it.
&lt;c&gt;
[am]king ~/a$ perl -we 'do { $u = 0; print "$_: ", /^((?{$u++})(?:a|aa))+$/ ? "hit" : "miss", ", parens called $u times\n" } for qw"aaaaaaaaa aaaaaaaaab";'
aaaaaaaaa: hit, parens called 10 times
aaaaaaaaab: miss, parens called 20 times
&lt;/c&gt;
However, you can force it to blow up if you make the optimization impossible with a &lt;c&gt;(??{&lt;/c&gt; -- which incidentally shows that "have I recursed" conditionals are not the only thing why these kinds of optimizations are difficult. 
&lt;c&gt;
[am]king ~/a$ perl -we 'do { $u = 0; print "$_: ", /^((??{$u++;""})(?:a|aa))+$/ ? "hit" : "miss", ", parens called $u times\n" } for qw"aaaaaaaaa aaaaaaaaab";'
aaaaaaaaa: hit, parens called 10 times
aaaaaaaaab: miss, parens called 143 times
&lt;/c&gt;
Backreferences can also inhibit this optimization:
&lt;c&gt;
[am]king ~/a$ perl -we 'do { $u = 0; print "$_: ", /j(.)rd((?{$u++})(?:\1|\1\1))+j/ ? "hit" : "miss", ", parens called $u times\n" } for qw"jard"."a"x16 ."bjord"."o"x16 ."j";'
jardaaaaaaaaaaaaaaaabjordooooooooooooooooj: hit, parens called 4197 times
[am]king ~/a$ perl -we 'do { $u = 0; print "$_: ", /j(.)rd((?{$u++})(?:[ao]|[ao][ao]))+j/ ? "hit" : "miss", ", parens called $u times\n" } for qw"jard"."a"x16 ."bjord"."o"x16 ."j";'
jardaaaaaaaaaaaaaaaabjordooooooooooooooooj: hit, parens called 76 times
&lt;/c&gt;
This means that if you want to implement this memoization thing in the perl RE engine, you'll have to work with finding out when you can correctly apply it and when you can't. 
I'm starting to really admire the engine (and those who wrote it) that it can work all this out.
&lt;p&gt;
I guess might make all this a meditation.  As a reference to myself: [id://577368].
&lt;p&gt;
&lt;hr&gt;
&lt;p&gt;
&lt;c&gt;
print {;log=&gt;} "hi";
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
For [tye].
A command to rename some files, answer for a question on irc.  Note how I avoid elseifs with [next].
&lt;c&gt;
perl -we 'use File::Find; finddepth sub {{ /\A(\d{5}-p)(\d+)(\.tif)\z/ or next; my $n = sprintf("%s%04d%s", $1, $2, $3); -e $n and next; warn "$_ =&gt; $n\n"; rename $_, $n or die "error rename $_ $n: $!"; }}, ".";'
&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;&lt;!-- Sun Aug 27 21:19:52 CEST 2006 --&gt;
For [creamygoodness], on embedding C snippets into C as data, here's a quine I wrote ages ago.  
&lt;c&gt;
// 323 - Self reproducing program by Ambrus ZSBAN
//
// This program writes its source code to stdout.
// RVLVQRVLVQ

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
char s1[]=
"// 323 - Self reproducing program by Ambrus ZSBAN\n"
"//\n"
"// This program writes its source code to stdout.\n"
"// RVLVQRVLVQ\n"
"\n"
"#include &lt;stdio.h&gt;\n"
"#include &lt;string.h&gt;\n"
"char s1[]=\n"
"\"";
char s2[]=
"\";\n"
"\n"
"int main (void) {\n"
"    char *p;\n"
"    int x;\n"
"    printf (\"%s\", s1);\n"
"    p= s1;\n"
"    while (*p) {\n"
"        switch (*p) {\n"
"            case '\\n':\n"
"                printf (\"\\\\n\\\"\\n\\\"\");\n"
"                break;\n"
"            case '\\\\':\n"
"                printf (\"\\\\\\\\\");\n"
"                break;\n"
"            case '\\\"':\n"
"                printf (\"\\\\\\\"\");\n"
"                break;\n"
"            default:\n"
"            x= strcspn (p, \"\\n\\\\\\\"\");\n"
"            printf (\"%.*s\", x, p);\n"
"            p+= x -1;\n"
"            }\n"
"        p++;\n"
"        }\n"
"    printf (\"\\\";\\nchar s2[]=\\n\\\"\");\n"
"    p= s2;\n"
"    while (*p) {\n"
"        switch (*p) {\n"
"            case '\\n':\n"
"                printf (\"\\\\n\\\"\\n\\\"\");\n"
"                break;\n"
"            case '\\\\':\n"
"                printf (\"\\\\\\\\\");\n"
"                break;\n"
"            case '\\\"':\n"
"                printf (\"\\\\\\\"\");\n"
"                break;\n"
"            default:\n"
"            x= strcspn (p, \"\\n\\\\\\\"\");\n"
"            printf (\"%.*s\", x, p);\n"
"            p+= x -1;\n"
"            }\n"
"        p++;\n"
"        }\n"
"    printf (\"%s\", s2);\n"
"    return;\n"
"    }\n"
"\n"
"\n"
"";

int main (void) {
    char *p;
    int x;
    printf ("%s", s1);
    p= s1;
    while (*p) {
        switch (*p) {
            case '\n':
                printf ("\\n\"\n\"");
                break;
            case '\\':
                printf ("\\\\");
                break;
            case '\"':
                printf ("\\\"");
                break;
            default:
            x= strcspn (p, "\n\\\"");
            printf ("%.*s", x, p);
            p+= x -1;
            }
        p++;
        }
    printf ("\";\nchar s2[]=\n\"");
    p= s2;
    while (*p) {
        switch (*p) {
            case '\n':
                printf ("\\n\"\n\"");
                break;
            case '\\':
                printf ("\\\\");
                break;
            case '\"':
                printf ("\\\"");
                break;
            default:
            x= strcspn (p, "\n\\\"");
            printf ("%.*s", x, p);
            p+= x -1;
            }
        p++;
        }
    printf ("%s", s2);
    return;
    }


&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
Here's the ruby version of the CGI script I tried to make work below.  This one seems to work, but I can't make a demonstration that can be viewed from outside because the firewalls on webservers block that.
&lt;c&gt;
#!/usr/local/bin/ruby -w

IMAGE_NAME = "/home/ambrus/a/flycgi/leer.jpg";

require "socket";
require "timeout";

print "Content-Type: text/html; charset=ISO-8859-2\n\n";
print %{&lt;html&gt;
&lt;head&gt;
&lt;title&gt;On-the-fly server experiment&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;On-the-fly server experiment with ruby&lt;/h1&gt;
&lt;p&gt;This CGI script experiments with starting a TCP server connection
on the fly to serve an image embedded in the page.  
I do not recommend this technique for production.
&lt;p&gt;
So, here's an image:
};

lsock = Socket.new(Socket::PF_INET, Socket::SOCK_STREAM, 0);
lsock.listen 1;
port = Socket.unpack_sockaddr_in(lsock.getsockname)[0];
imgthread = Thread.new {
        begin
                asock = ();
                timeout(60) {
                        asock, * = lsock.accept;
                };
                imgfile = File.open IMAGE_NAME;
                imgsize = imgfile.stat.size;
                asock.print "HTTP/1.1 200 Ok\nContent-type: image/jpeg\n" +
                        "Content-length: " + imgsize.to_s + "\n\n";
                while b = imgfile.read(16*1024);
                        asock.print b;
                end;
                asock.close;
        rescue Timeout::Error;
        end;
};
server_name = ENV["SERVER_NAME"] || "localhost";
print %{&lt;img src="http://} + server_name + ":" + port.to_s + %{/" alt="some dynamic image"&gt;};

print %{&lt;p&gt;Goodbye for now.
&lt;/body&gt;&lt;/html&gt;
};
$&gt;.flush;

imgthread.join;

__END__

&lt;/c&gt;
&lt;p&gt;
This is the CGI script I'm trying to write as an experiment to serve an image in a strange way.  It segfaults on the webserver at the point when it first wants to start the coroutine.  I'm trying though on another machine that doesn't have a webserver it seems to work fine.  You may have to change some pathnames in it, like the path to the error log  (take care, it's overwritten every time) and the path to the image to be served.   
&lt;c&gt;
#!/usr/bin/perl -T
use warnings; use strict; 

BEGIN {
        use IO::Handle;
        open our $LOG, "&gt;", "/home/student/ambrus/a/html/.fly.log" or die "cannot write error log";
        sub tolog {
                chomp(my $s = join("", @_));
                warn "logged: " . $s;
                print $LOG "fly " . localtime() . ": " . $s . "\n" or die "cannot write error log";
                flush $LOG;
        }
        tolog "starting";
        $SIG{__WARN__} = \&amp;tolog;
        our $OLDSIGDIE = $SIG{__DIE__}; $SIG{__DIE__} = \&amp;tolog;
} CHECK { 
        #$SIG{__DIE__} = our $OLDSIGDIE;
        tolog "checking";
} END {
        tolog "ending";
}
eval {

use lib "/home/student/ambrus/local/perl/lib/perl/5.8.4";
use Coro; use Coro::Handle; use Coro::Timer; use Coro::Socket;
use Socket; 
print qq{Content-Type: text/html; charset=ISO-8859-2\n\n};
my @jobs;
push @jobs, async { 
tolog "[D10]";
select unblock *STDOUT;
print qq{&lt;html&gt;
&lt;head&gt;
&lt;title&gt;On-the-fly server experiment&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;On-the-fly server experiment&lt;/h1&gt;
&lt;p&gt;This CGI script experiments with starting a TCP server connection
on the fly to serve an image embedded in the page.  
I do not recommend this technique for production.
&lt;p&gt;
So, here's an image:
};
socket my $S, PF_INET(), SOCK_STREAM(), 0 or die "socket $!"; 
listen $S, 1 or die "listen $!"; 
my($p, undef) = sockaddr_in(getsockname $S); 
push @jobs, async {
        eval {
        my $Su = Coro::Socket-&gt;new_from_fh($S);
        my $A = $Su-&gt;accept or die "accept: $!";
        open my $I, "&lt;", "/home/student/ambrus/a/html/pu/egyetem.jpg" or die "open image: $!";
        print $A "HTTP/1.1 200 Ok\nContent-type: image/jpeg\n" .
                "Content-length: " . (-s $I) . "\n\n" or
                die "print image header: $!";
        while (read $I, my $b, 4*1024) {
                print $A $b;
                #Coro::Timer::sleep 0.1;
        }
        close $A;
        };
        $@ and warn($@), die($@);
};
my $sn = $ENV{"SERVER_NAME"} || "localhost";
print q{&lt;img src="http://} . $sn . ":" . $p . q{/"&gt;
&lt;p&gt;
Now I'll print some lines just to see if the image data and
the webpage can be loaded async.
};
for my $i (1 .. 10) {
        Coro::Timer::sleep 2;
        print q{&lt;P&gt;Just a line } . $i . qq{, nothing more.\n};
}
print q{&lt;p&gt;Goodbye for now.
&lt;/body&gt;&lt;/html&gt;
};
};
tolog "[D20]";
$_-&gt;join for @jobs;

}; $@ and do {
        tolog $@;
};

__END__

&lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
Documentation format conversion graph
&lt;c&gt;
docbook -&gt; texinfo =&gt; dvi =&gt; postscript -&gt; pdf;
dvi =&gt; pdf -&gt; postscript;
texinfo =&gt; info =&gt; text;
docbook -&gt; manroff =&gt; text;
texinfo -&gt; html -&gt; text;
pod =&gt; manroff;
pod -&gt; html;
pod -&gt; text;
pod -&gt; latex =&gt; dvi;
latex -&gt; html; 
docbook =&gt; html;
docbook -&gt; pdf;
&lt;/c&gt;
&lt;p&gt;
The block of edit keys on my new keyboard is vertical:
&lt;table border="1"&gt;
&lt;tr&gt;&lt;td&gt;Home&lt;td&gt;End
&lt;tr&gt;&lt;td&gt;Ins&lt;td&gt;PgUp
&lt;tr&gt;&lt;td&gt;Del&lt;td&gt;PgDn
&lt;/table&gt;
&lt;p&gt;
When you redo in a while loop, it doesn't just goto back to the loop body.  It gotos out of the scope of the loop and then gotos back in after the starting brace.  Thus, the variable you declare as lexical in the loop condition behaives as a &lt;c&gt;my if 0&lt;/c&gt; variable in this case.  Here's an example:
&lt;c&gt;
[am]king ~$ perl -we 'while (!eof(STDIN)) { my $line = &lt;STDIN&gt; if 0 == @x % 3; push @x, \$line; print \$line, ": ", ($line || 0), "\n"; }; ' &lt;&lt;&lt;$'a\nb\n'
SCALAR(0x812c9c0): a

SCALAR(0x812c048): 0
SCALAR(0x812c048): 0
SCALAR(0x812c048): b

SCALAR(0x812c9a8): 0
SCALAR(0x812c9a8): 0
SCALAR(0x812c9a8): 

[am]king ~$ perl -we 'while (my $line = &lt;STDIN&gt;) { push @x, \$line; print \$line, ": ", ($line || 0), "\n"; redo if 0 != @x % 3; }; ' &lt;&lt;&lt;$'a\nb'
SCALAR(0x812c9c0): a

SCALAR(0x812c048): 0
SCALAR(0x812c048): 0
SCALAR(0x812c048): b

SCALAR(0x812c9a8): 0
SCALAR(0x812c9a8): 0
[am]king ~$ &lt;/c&gt;
&lt;hr&gt;
&lt;p&gt;
For [tye]:
&lt;c&gt;
UTF-8

ENCODING
       The  following  byte  sequences  are used to represent a character. The
       sequence to be used depends on the UCS code number of the character:

       0x00000000 - 0x0000007F:
           0xxxxxxx

       0x00000080 - 0x000007FF:
           110xxxxx 10xxxxxx

       0x00000800 - 0x0000FFFF:
           1110xxxx 10xxxxxx 10xxxxxx

       0x00010000 - 0x001FFFFF:
           11110xxx 10xxxxxx 10xxxxxx 10xxxxxx

       0x00200000 - 0x03FFFFFF:
           111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx

       0x04000000 - 0x7FFFFFFF:
           1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx

       more bits (non-standard extension):
           11111110 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111111 100xxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111111 1010xxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111110 10110xxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111110 101110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111110 1011110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111110 10111110 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

           11111110 10111111 100xxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 

....


       The xxx bit positions are filled with the bits of  the  character  code
       number  in binary representation. Only the shortest possible multi-byte
       sequence which can represent the code number of the  character  can  be
       used.

       The UCS code values 0xd800-0xdfff (UTF-16 surrogates) as well as 0xfffe
       and 0xffff (UCS non-characters) should not appear in  conforming  UTF-8
       streams.

&lt;/c&gt;
&lt;hr&gt;

&lt;p&gt;
This is for the compressed bootfloppy I wrote.  
&lt;p&gt;
config.sys:
&lt;c&gt;
switches=/f
device=himem.sys /testmem:off
device=ramdrive.sys 16384 512 /e
&lt;/c&gt;
&lt;p&gt;
autoexec.bat:
&lt;c&gt;
@echo off
echo,
echo,Ambrus bootfloppy
echo,Loading files from floppy, please wait...
set dircmd=/p/a/ogn
set prompt=$P$G
c:
ctty nul
for %%a in (d e f g h i j k l m n o p q) do %%a:
ctty con
md main
cd main
copy a:\se*.bat
if errorlevel 1 goto error
cd &gt;&gt; setpath.bat
call setpath.bat
set temp=%path%
copy a:\pk*.*
copy a:\s.*
copy a:\co*.com
if not exist %path%\command.com goto error
set comspec=%path%\command.com
pkunzjr s
pkunzjr f
del f.zip
echo,Ready
goto end
:error
echo,An error occurred.  Make sure you have the floppy in drive a:,
echo,and that you have at least 6M of memory.
:end
&lt;/c&gt;
&lt;P&gt;
setpath.bat contains "&lt;c&gt;set path=&lt;/c&gt;", without newline.
&lt;hr&gt;

&lt;p&gt;
Just a collection of languages.  Some of it might be worthwile to look at.  Google. 
&lt;ol&gt;
&lt;li&gt;
Perl-related: Perl, Perl6, Parrot,
&lt;li&gt;
Scheme implementations: PLT Scheme, Bigloo, Guile, MIT Scheme, Elk Scheme,
&lt;li&gt;
Other high-level languages, dynamically typed: GCL (common lisp), Python, Ruby, Lua, Pike, J (from JSoftware), JavaScript, Forth,
&lt;li&gt;
Statically typed languages: Haskell, Dylan, Sather, SML, Eiffel, OCaml,
&lt;li&gt;
Low level languages: C, C++, Delphi, D (from Digitalmars),
&lt;li&gt;
Popular languages: Java, DotNet, </field>
</data>
</node>
