Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

It's a perlmonk.

by frankus (Priest)
on Nov 05, 2001 at 16:56 UTC ( [id://123321]=obfuscated: print w/replies, xml ) Need Help??

It solves Erudil's find-a-func, type something like:
./find-a-func.pl | ./perl-monk.pl

if the d/l code doesn't work, try here
#!/usr/bin/perl use strict; print "\nSaid the Llama to the Lama:\n"; my (@Llama, %answers, @llama, @questions) = map{ print;$_ +}(<>); die "seeking a llama to share pipe!\n" unless $Llama[0]=~/ +Find/; print "\nSaid the Lama to the Llama:\n"; my$karma=0 ;for ( @Llama ){chomp; ; chomp; s/Fi/Fou/;s/-/--/; ;/ /; my ( $lama, $llama ) = ($`,$'); s/ //g for( $lama , $llama); $|=0;push @questions,$llama unless $llama=~ /^$/ ; push @llama,# $lama unless $lama=~ /^$/} %answers = map { $_ , 0, scalar reverse( split // ) ,0 }@questions;my @karma=llama( @llama);my @dharma = llama(map { ( ' ') x $_ . $llama[$_]. (' ') x (1* $#llama -$_)}(0..$#llama)); my @lama=map{$a = $_;;;;; s/( *)(\w+)( *)/$3$2$1/; $a}@dharma; my %find = (lama => \@llama,dharma =>\@karma,karma =>\@dharma ,llama=> \@lama); sub llama{map{$|++; my $grazing= $_ ;join( '', map{ ( split //,$_[ $_ ]) [$grazing] } (0..$#_ ))}(0.. ( length($_[0])-1))}sub dharma{m +y @llama = @{$_[0]} ;[map{s/[a-z]/\*/g;; ; $_}@llam +a ] };; my %llama= map{$_,dharma($find{$_}) } ( ke +ys %find );; sub karma { my $reasons=shift ;; ; ; +my @answers = @{ $find{ "$reasons" } };; for my $questions (keys%answers){next if $answers{ $question +s }; study $questions;for (0.. $#answers ) { if ( $answers[ $_]=~/$questions/){my($soul ,$seeks , $to_know )=($`,$' ,$&) ;s/\w/\*/g for ($seeks, $to +_know, $soul);$llama{ $reasons} ->[$_]=$soul . $questions .$seek +s;$karma ++;$answers{ $questions} ++ ; $answers{ reverse( split//,$ +to_know)}++ }}}};for(keys %find){ karma($_ )};my@dali =map{$a= $_;$a=~s/ +./\*/g;$a} (@llama); for my $karma(keys %llama){ $llama {$karma} +=[ llama( @{$llama{$karma}})] if $karma=~/.{5}/ ;for(0 .. $#{$llama{$ +karma}}){ $llama{$karma}->[$_] =~s/ //g;my@Lama =split//, $dali[$_];my +@lAma= split//,$llama{$karma}->[$_];$dali[$_]= join('',map{($lAma +[$_] ne '*') ? $lAma[$_]:$Lama[$_]}(0..$#lAma));}}my @answer=map { s/ +(.)/$1 /g ;s/\*/ /g; ($_,' 'x(length($_)))}(@dali);my($llama,$lama)=sort($#qu +estions, $#answer) ; for (0..$lama) {print $answer[$_]," ",$questions[$_ +],"\n" }



Updated:It was written for Perl 5.6.1 where "my $karma++" works
I've changed that to "my $karma=0" in the hope it works for earlier verions ... profound really ;)

Thanks to Erudil,virtualsue,monkfish and marvell for checking this out. I'll be less impatient next time.

--

Brother Frankus.

¤

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://123321]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-19 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found