Elthek has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I had the most wonderful idea for my first JAPH. I hacked it together, it worked, I rejoiced. I tried it some other systems. It produced amusingly bad results. :-)

So, I need your help. Please mail me the output from the following, along with your distribution; the most prevalent indexes will grace the JAPH and my .signature. perl -lne'$x=$_;print "$. $_" if grep /^$x$/i, qw/just another hacker/' /usr/share/dict/words' The JAPH itself hasn't been optimised at all - any help with that appreciated - but here it is. It works as intended on my Debian machine: perl -le'@a=qw/23138 19231 2038/;while(<>){chomp;push @b,$_ if grep {$.==$_} @a}push @b,$^X;print ucfirst join(" ",@b[2,0,3,1]).","'</usr/share/dict/words

Replies are listed 'Best First'.
Re: JAPH help needed.
by hopes (Friar) on May 19, 2002 at 09:58 UTC
    I think that if you ask for help to the monks, you have to went to the monastery to obtain your help, so...

    Your code
    perl -lne'$x=$_;print "$. $_" if grep /^$x$/i, qw/just another hacker/ +' /usr/share/dict/words'
    should be:
    perl -lne'$x=$_;print "$. $_" if grep /^$x$/i, qw/just another hacker/ +'< /usr/share/dict/words
    and this is the output in a Red Hat 7.1:
    2040 another 19245 hacker 23151 just
    This is the output of the JAPH in my Red Hat 7.1
    perl -le'@a=qw/23151 19245 2040/;while(<>){chomp;push @b,$_ if grep {$ +.==$_} @a}push @b,$^X;print ucfirst join(" ",@b[2,0,3,1]).","'</usr/s +hare/dict/words Just another perl hacker,


    Hopes
    $_=$,=q,\,@4O,,s,^$,$\,,s,s,^,b9,s, $_^=q,$\^-]!,,print