Lession3: Convert Hex-Dec-Oct-Bin

http://perltips.wikidot.com/convert-hex-dec-oct-bin use Perl to realize the convert among hex, dec, oct and bin. ############################## # convert hex to binary addr # ############################## # $short_ID[2] = 1fH chop($short_ID[2]); # $short_ID[2] = 1f my @bin_judg = split(/[\t]*/, $short_ID[2]); if(@bin_judg==2) { # it’s hex format: 1fH $short_ID[2] = sprintf( “%b”, hex( $short_ID[2])); @bin_judg = split(/[\t]*/, $short_ID[2]); } if(@bin_judg==5) […]

Lession2: Perl Arrays

Link: http://www.tutorialspoint.com/perl/perl_arrays.htm #!/usr/bin/perl (just used for note, actually we can ignore it with no side effects) @ages = (25,30,40); @names = (“John Paul”, “Lisa”, “Kumar”); print “\$ages[0] = $ages[0]\n”; print “\$ages[1] = $ages[1]\n”; print “\$ages[2] = $ages[2]\n”; print “\$names[0] = $names[0]\n”; print “\$names[1] = $names[1]\n”; print “\$names[2] = $names[2]\n”; Attention: use backslash(\) before $ sign to […]

Lession1: Perl Operators

Link: http://www.tutorialspoint.com/perl/perl_operators.htm Perl Equality Operators: Assume variable $a holds 10 and variable $b holds 20 then: Operator Description Example + Addition – Adds values on either side of the operator $a + $b will give 30 – Subtraction – Subtracts right hand operand from left hand operand $a – $b will give -10 * Multiplication – […]

Hash function & hashCode

reference: 1. http://en.wikipedia.org/wiki/Hash_function 2. http://zh.wikipedia.org/wiki/%E6%95%A3%E5%88%97%E5%87%BD%E6%95%B8 3. http://en.wikipedia.org/wiki/Java_hashCode() 4. http://blog.csdn.net/v_JULY_v/article/details/6256463#comments 5. http://baike.baidu.com/view/329976.htm A hash function is any function that can be used to map digital data of arbitrary size to digital data of fixed size. The values returned by a hash function are called hash values, hash codes, hash sums, or simply hashes. One practical use […]

Share(Send) information from one process to another

reference: 1. http://en.wikipedia.org/wiki/Inter-process_communication 2. http://en.wikipedia.org/wiki/Message_Passing_Interface Inter-process communication (IPC) is the activity of sharing data across multiple and commonly specialized processes using communication protocols. Typically, applications using IPC are categorized as clients and servers, where the client requests data and the server responds to client requests.[1] Many applications are both clients and servers, as commonly seen […]