#! /usr/local/bin/perl $|=1; # set output unbuffered print "%form top topLevel\n" ."%asciiText input top editType edit width 200\n" ."%action input override {Return: exec(echo [gV input string])}\n" ."%label result top label {} width 200 fromVert input\n" ."%command quit top fromVert result callback quit\n" ."%label info top fromVert result fromHoriz quit label {} borderWidth 0 width 150\n" ."%realize\n"; while() { chop; if (/^\d+$/) { print "%sV info label {thinking ...}\n"; $starttime = time; for ($d=2,@result=(); $d <= $_; $d++) { while (!($_ % $d)) { unshift(@result,$d); $_ /= $d; } } print "%sV result label {" .join('*',@result). "}\n" ."%sV info label {".(time-$starttime)." seconds}\n" ; } else { print "%sV info label {invalid input}\n"; } }