@j=split$",<>;print$% map$%+=2*$q[$_%@j[1]]++,split$",<>

Above is the perl code I want to reduce.Can someone help?I am new to perl and somehow I wrote the code in perl and using differnt golfing techniques I reduced the code from 72 to 56 characters but there is someone with 51 characters code .

Question:

Modulo Strength Max. Marks: 100 Alice is the teacher of a class having N students, where each student is having some personality value, given in the form of an array A. Here Ai denotes the personality value of ith student, where 1≤i≤N. Alice has special integer K with her. Student i is a friend of Student j, if and only if (A[i]%K)=(A[j]%K). Each student's strength is equal to the number of friends he/she has. Alice needs to calculate the sum of the strength of all the students in the class. Help Alice for the same.
Note: This is a Code golf problem. You need to write code with minimum number of characters.
Input: First line contains 2 integers N,K, denoting the number of students in the class and the special integer Alice is having respectively. Second line contains N space separated integers, denoting the personality value of each student.
Output: Print the sum of the strength of all the students in the class.
Constraints: 1≤N≤10^5 1≤K≤10^5 1≤Ai≤10^9
If your program passes all the testcases, the score will be assigned according to the following formula:

score = 0.1 num_chars = length of source code if (num_chars < 500): Score = (500 - 2*num_chars) / 5

You can understand that you have to reach as close to 50 as possible. Also your code needs to pass all the testcases before a score can be assigned, there is no partial scoring here. Have fun :)
SAMPLE INPUT
5 5
6 11 16 7 12
SAMPLE OUTPUT
8
Explanation Here, 6,11,16 are friends of each other as all will result in 1 when modulo with 5. Here each student is having strength 2. Similarly 7,12 are friends of each other, as all will result in 2 when modulo with 5. Here each student is having strength 1. Total Strength of class is 3×2+2×1=8

Update

@j=split$",<>;print$% map$%+=2*$q[$_%@j[1]]++,split$",<>

Above is the perl code I want to reduce.Can someone help?I am new to perl and somehow I wrote the code in perl.


In reply to Golf code in perl by tt08

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.