/*     Eduardo Rene Rodriguez Avila   Copyright(c)    Estas funciones pueden ser copiadas y distribuidas libremente mientras    se conserven estas lineas de comentarios y no se modifique el codigo.      This functions can be copied and freely distributed as these comments   and source code are not modified.  Perl*/      function Previous(){   Cookie=Cookie-1<=0?(Cookies.length/2):Cookie-1;   DisplayButtons();   DisplayCookie();   document.close();}function Next(){   Cookie=Cookie%(Cookies.length/2)+1;   DisplayButtons();   DisplayCookie();   document.close();}function ChooseOne(){   Cookie=Math.floor(Cookies.length/2*Math.random())+1;   DisplayCookie();}function GoTo(){    idx=parseInt(prompt("Cookie",Cookie),10);   if( ! isNaN(idx) )      if( 0<idx && idx<=Cookies.length/2)         Cookie=idx;   DisplayButtons();   DisplayCookie();   document.close();}function DisplayCookie(){   document.write("<SMALL><P CLASS=left>");   document.write(Cookies[(Cookie-1)*2+1]+"<BR>"+Cookies[(Cookie-1)*2+2]);   document.write("</SMALL>");}function DisplayButtons(){   document.writeln("<HTML><HEAD><LINK REL='stylesheet' TYPE='text/css' HREF=style.css TITLE=TheStyleSheet></HEAD>");   document.writeln("<BODY BGCOLOR=SILVER>");   document.write("<SCRIPT TYPE='text/javascript' LANGUAGE=JavaScript SRC=scripts.js></SCRIPT>");   document.write("<SCRIPT TYPE='text/javascript' LANGUAGE=JavaScript SRC=cookies8.js></SCRIPT>");   document.write("<SCRIPT TYPE='text/javascript' LANGUAGE=JavaScript>Cookie="+Cookie+"</SCRIPT>");   document.write("<CENTER>");   document.writeln("<BUTTON OnClick='Previous();'><STRONG>\<</STRONG></BUTTON>&nbsp;");   if( Cookie==0 )       document.writeln("<BUTTON OnClick='GoTo();'>Select</BUTTON>");   else       document.writeln("<BUTTON OnClick='GoTo();'>Cookie:"+Cookie+"/"+Cookies.length/2+"</BUTTON>");   document.writeln("<BUTTON OnClick='Next();'><STRONG>\></STRONG></BUTTON>");   document.write("</CENTER>");   document.write("<BR>");}var Cookies = new TheArray('<B># run contents of "my_file" as a program</B>','<CODE CLASS=normal>perl my_file</CODE>','<B># run debugger "stand-alone"</B>','<CODE CLASS=normal>perl -d -e 42</CODE>','<B># run program, but with warnings</B>','<CODE CLASS=normal>perl -w my_file</CODE>','<B># run program under debugger</B>','<CODE CLASS=normal>perl -d my_file</CODE>','<B># just check syntax, with warnings</B>','<CODE CLASS=normal>perl -wc my_file</CODE>','<B># useful at end of "find foo -print"</B>','<CODE CLASS=normal>perl -nle unlink</CODE>','<B># useful at end of "find foo -print"</B>','<CODE CLASS=normal>perl -e \'print "hello world!\\n"\'</CODE>','<B># add first and penultimate columns</B>','<CODE CLASS=normal>perl -lane \'print $F[0] + $F[-2]\'</CODE>','<B># just lines 15 to 17</B>','<CODE CLASS=normal>perl -ne \'print if 15 .. 17\' *.pod</CODE>','<B># in-place edit of *.c files changing all foo to bar</B>','<CODE CLASS=normal>perl -p -i.bak -e \'s/\\bfoo\\b/bar/g\' *.c</CODE>','<B># command-line that prints the first 50 lines (cheaply)</B>','<CODE CLASS=normal>perl -pe \'exit if $. > 50\' f1 f2 f3 ... </CODE>','<B># delete first 10 lines</B>','<CODE CLASS=normal>perl -i.old -ne \'print unless 1 .. 10\' foo.txt</CODE>','<B># change all the isolated oldvar occurrences to newvar</B>','<CODE CLASS=normal>perl -i.old -pe \'s{\\boldvar\\b}{newvar}g\' *.[chy]</CODE>','<B># command-line that reverses the whole file by lines</B>','<CODE CLASS=normal>perl -e \'print reverse <>\' file1 file2 file3 ....</CODE>','<B># find palindromes</B>','<CODE CLASS=normal>perl -lne \'print if $_ eq reverse\' /usr/dict/words</CODE>','<B># command-line that reverse all the bytes in a file</B>','<CODE CLASS=normal>perl -0777e \'print scalar reverse <>\' f1 f2 f3 ...</CODE>','<B># command-line that reverses the whole file by paragraphs</B>','<CODE CLASS=normal>perl -00 -e \'print reverse <>\' file1 file2 file3 </CODE>','<B># increment all numbers found in these files</B>','<CODE CLASS=normal>perl i.tiny -pe \'s/(\d+)/ 1 + $1 /ge\' file1 file2 ....</CODE>','<B># command-line that shows each line with its characters backwards</B>','<CODE CLASS=normal>perl -nle \'print scalar reverse $_\' file1 file2 file3 ....</CODE>','<B># delete all but lines beween START and END</B>','<CODE CLASS=normal>perl -i.old -ne \'print unless /^START$/ .. /^END$/\' foo.txt</CODE>','<B># binary edit (careful!)</B>','<CODE CLASS=normal>perl -i.bak -pe \'s/Mozilla/Slopoke/g\' /usr/local/bin/netscape</CODE>','<B># look for dup words</B>','<CODE CLASS=normal>perl -0777 -ne \'print "$.: doubled $_\n" while /\\b(\\w+)\\b\\s+\\b\\1\\b/gi\' </CODE>','<B># command-line that prints the last 50 lines (expensively)</B>','<CODE CLASS=normal>perl -e \'@lines = <>; print @lines[ $#lines .. $#lines-50\' f1 f2 f3 ...</CODE>');