Program in C++ (newbie), C (newbie), Perl (newbie) and Matlab