From merlyn@iwarp.intel.com (Randal Schwartz) 1 Feb 90 22:28:58 GMT @a=split(/(\d)/,"4Hacker,2another3Perl1Just");shift(@a);%a=@a;print "@a{1..4}"; ================================= From Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) 22 Aug 90 11:10:18 GMT $s=(localtime(time))[0]; sub n { ($a - $b) * $s; } print grep(s/.*\t//,sort n grep($_=++$i/-50."\t$_",split(/\n*/,<From merlyn@iwarp.intel.com (Randal Schwartz) 29 Aug 90 19:14:54 GMT print pack("c*",(32..127)[42,85,83,84,0,65,78,79,84,72,69,82,0,48,69,82,76,0,72 ,65,67,75,69,82,12]) ================================= Date: 6 Feb 90 22:31:17 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print grep(s/^\d+(.*)/$1 /, sort(split(/ /,"8hacker, 4Perl 1Just 2another"))); ================================= Date: 5 Feb 90 18:08:59 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) %_=split(/(\D+)/,"7Perl6another8hacker,5Just");print"@_{5..8}"; ================================= From: merlyn print pack('C25', grep($_ && $_ -= 256, split(/(\d\d\d)/, <)=~/^(.*)/;' ================================= Date: 23 Feb 90 19:01:21 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) format STDOUT = @<<< @<<<<<< @<<< @<<<<<, $Just, $another, $Perl, $hacker . for("Just","another","Perl","hacker"){eval"\$$_=\$_;";};write; ================================= Date: 23 Feb 90 19:04:55 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $,=' ';print grep(s/^.//, sort "2another","4hacker,","1Just","3Perl"); ================================= Date: 23 Feb 90 23:23:53 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) @a=split(/X*/," ,JPacehklnorstu");print@a[2,15,13,14,0,4,10,11,14,7,6,12,0,3,6,12,9,0,7,4,5,8,6,1 2,1]; ================================= Date: 27 Feb 90 17:33:57 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) Subject: Re: more termcap.pl problems & a quick question In-reply-to: pem@frankland-river.aaii.oz.au (Paul E. Maisano) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Newsgroups: comp.lang.perl In article <1172@frankland-river.aaii.oz.au>, pem@frankland-river (Paul E. Maisano) writes: | sub p { | local($str) = @_; | $str =~ s/([\000-\037])/"^".pack("c", ord($1)+0100)/eg; | print $str; | } [well, he said more than that, but that's the important part... :-] how about handling DEL too? sub unctrl { local($_) = @_; s/([\000-\037\177])/'^'.pack('c',ord($1)^64)/eg; $_; } print &unctrl("\000\002\n\r\027ABC\177"),"\n"; results in: ^@^B^J^M^WABC^? print &unctrl("Just another Perl hacker,"); -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/ ================================= Date: 27 Feb 90 17:48:36 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) for (split(/(.)/,"Just another Perl hacker,")) {print if $_;} ================================= Date: 28 Feb 90 01:32:25 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) @a=<;echo Just another Perl hacker,>; print join(" ",@a); ================================= Date: 28 Feb 90 01:51:32 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) mkdir("/tmp/$$",0777); chdir "/tmp/$$"; grep(open(X,">$_"),"1Just","2another","3Perl","4hacker,"); print join(" ",grep(s/^.//,<*>)); chdir ".."; system "rm -rf $$"; ================================= Date: 28 Feb 90 02:03:37 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = <; ================================= Date: 6 Mar 90 11:07:32 GMT From: Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) @l = split (/(..)/,'1a7r4J1n0a7e7c1o8n248o1t4u8v4s7.207l27547a7n7g1h'. '0 511e3h7.8i564t3a6P1r7p8c8e6e3c3k7e3e533r7r286r6l4 6 1 8,7l7 3,'); srand; $_=3*int(rand(2))+2; /^$_/; foreach (split(//,&g)) {/^$_/;print &g;} print "\n"; sub g {join('',grep(s/^.//,grep(//,@l)));} ================================= Larry> for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"')) Larry> {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n"; Larry> And a special version just for Randal: Larry> grep(do{for(ord){$i+=$_%8;grep(vec($s,$i++,1)=1,5..($_>>3||print"$s\n"));}}, Larry> (@x=split(//,"))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)\7"))); ================================= Date: 6 Mar 90 18:08:23 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) open(C,"|uncompress");$_=<) {next unless /([A-Z]):(.*)/; $m{$2}=$1;} close(M); print grep($_ = ($m{$_} || $_), split(/([^-.])/,<&STDOUT");warn "Just another Perl hacker,\n" ================================= Date: 28 Mar 90 18:06:57 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = "Just a sed user,";s/a/another/;s/sed/Perl/;s/user/hacker/;print ================================= Date: 28 Mar 90 19:27:25 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_="reJ alounPt srhaetchr, ek";s/(..)(.)(..)/(print$2),$3.$1/eg;s/(.)(.)(.)/(print$2),$3.$1/eg;pr int ================================= Date: 28 Mar 90 21:35:44 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) ($_="Just another Perl hacker,"); 0 while s#.# do {print $&;} #e,s/^1//; ================================= Date: 30 Mar 90 19:18:27 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_=<5)]=~s/\*/vec($_,8*length($`)+$b-1,1)=1/eg while++$b<9;print; **** ******* **** ****** ************ *********** ......................... *** * * * * * * ** * * * * * * * *** * * * * * * * ** * * ** * ** * * * * **** -- ================================= Date: 3 Apr 90 22:44:56 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) @ARGV=split(/\S\n?/,<$_");print<$_*>;unlink; ================================= Date: 2 May 90 16:44:45 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = "Jvtu bopuifs Pfsm ibdlfs,"; y/a-z/za-y/; print ================================= Date: 6 Apr 90 17:09:14 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) sub _{$b-$a;}print((split(//,",rekcah lreP rehtona tsuJ"))[sort _ 0..24]) ================================= Date: 18 Apr 90 23:02:31 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_='vec(1,1,1); print substr($_ ^ "<\020\020\134\021M_CEA^RP\042\014\034\030\000\033\024\001\030\ 021\000\004",0,25)'; eval ================================= Date: 18 Apr 90 23:02:31 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_='vec(1,1,1); print substr($_ ^ "<\020\020\134\021M_CEA^RP\042\014\034\030\000\033\024\001\030\0 21\000\004",0,25)'; eval ================================= Date: 19 Apr 90 17:18:27 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print ('Just ','anoth','er Pe','rl ha','cker,')[0..4] ================================= Date: 2 May 90 16:44:45 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = "Jvtu bopuifs Pfsm ibdlfs,"; y/a-z/za-y/; print ================================= Date: 15 May 90 16:02:24 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) open(P,"|perl");print P"format=\nJust another Perl hacker,\n.\nwrite" ================================= Date: 22 May 90 21:41:18 GMT From: flee@shire.cs.psu.edu (Felix Lee) @a=split(//,$]);@b=split(//,"k ple th\nhroeaarcn.");$k=$#a=$#b;@a=sort grep($_.=$k++,@a);print@b[substr(pop(@a),1,2)-$#b]while(@a); ================================= Date: 25 May 90 15:29:25 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_=pack("c25",65..90);y/A-Y/Just another Perl hacker,/;print ================================= Date: 26 May 90 00:00:37 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) sub isplit { # &isplit(word,string) => array local($word,$_) = @_; local(@ind,@result,$start,$end); @ind = (0); s#$word#push(ind,length($`),length($`.$&)),$&#ieg; push(ind,length); # @ind now has pairs of indicies (0-origin) into $_ # that bound the non-$word items; convert into result: while (@ind) { $start = shift(ind); $end = shift(ind); push(result,substr($_,$start+$[,$end-$start)); } @result; } print &isplit("z","JzuZsztZ zaZnzoZtzhZezrZ zPZezrZlz ZhzaZczkZezrZ,"); ================================= Date: 5 Jun 90 19:07:58 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $,=" "; print +("hacker,","Just","Perl","another")[1,3,2,0]; ================================= Date: 14 Jun 90 06:38:52 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) open(o,"|cat");print o "Just another Perl hacker," ================================= Date: 15 Jun 90 01:37:14 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print `perl -e 'print STDERR "Just another Perl hacker,"' 2>&1` ================================= Date: 15 Jun 90 16:15:31 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = <<'-- '; s/../printf "%c",hex($&)/ge; 4a75737420616e6f74686572205065726c206861636b65722c -- ================================= Date: 15 Jun 90 22:06:24 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) printf "%s %s %s %s%c", 'Just', 'another', 'Perl', 'hacker', 44 ================================= Date: 16 Jun 90 19:22:20 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print <;echo Just another perl hacker,> ================================= Date: 18 Jun 90 07:49:28 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = "Just another Perl hacker,"; { redo if s/./(print $&),""/e; } ================================= Date: 18 Jun 90 15:53:11 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print "Just another Perl hacker," if "you can't think of anything better..." ================================= Date: 20 Jun 90 17:51:58 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_ = <<'-- '; s/../pack("c",hex($&))/eg; eval; 7072696e7420224a75737420616e6f74686572205065726c206861636b65722c22 -- ================================= Date: 25 Jun 90 20:58:27 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) %_=split(/(\D+)/,"4Perl1Just8hacker,2another");print"@_{sort(keys(_))}" ================================= Date: 26 Jun 90 18:02:43 GMT From: bill@ksr.com (Bill Mann) $_="another Just hacker $]".`ps c$$`;@_=split;print"@_[1,0,$#_,11,13,2],\n"; ================================= Date: 27 Jun 90 00:20:08 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) %_=@_=("Perl","hacker,");print"@_[!print 'Just '] @_{(keys _)[!print 'another ']}" ================================= ================================= Date: 28 Jun 90 17:57:59 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print "$ARGV[push(@ARGV,'Just another Perl hacker,')]" ================================= Date: 30 Jun 90 21:11:02 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) for("hacker","Perl","another","Just"){substr($x,0,0)="$_ ";}substr($x,-1,1)=",";print$x ================================= Date: 1 Jul 90 18:24:21 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) print grep($_=pack("c",hex($_)),unpack("A2"x 25,"4a75737420616e6f74686572205065726c206861636b65722 c")) ================================= Date: 1 Jul 90 22:55:10 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $x=25;print substr(',rekcah lreP rehtona tsuJ',$x,1) while --$x >= 0 ================================= Date: 3 Jul 90 00:19:58 GMT From: raymond@bosco.berkeley.edu (Raymond Chen) $_="-|";open _||print"creaJklrnue osrhptt,aeh ";while(<_>){$}=5;s/(.{$}})(.)/(print$2),$1/eg whil e--$};print;} ================================= Date: 5 Jul 90 17:18:01 GMT From: merlyn@iwarp.intel.com (Randal Schwartz) $_="cker,rl haer PeanothJust ";1 while s/(.{5})(.{5})?/$_{$2}=$1,$2/e;print while $_=$_{$_};