in reply to Unit testing with Perl
You should start by using the Test::Simple module in your Perl test scripts. This will give you a good idea on what testing in Perl is about. Its simply just evaluating a condition (in your case, whether the list processed by the C program is sorted), and then declaring a pass/fail. To automate the test script, you have to first write the routines which run the C program (via system possibly), redirect its output to file, read the file into an Perl array, etc.
Next, you can read about Test::More and Test::Deep.
Here's some sample code:
my @input = (5, 8, 12, 9, 78, 1, 5);
my @expected = (1, 5, 5, 8, 9, 12, 78);
my $i_file = "input.txt";
my $o_file = "output.txt";
my $bin = '/bin/c_program';
# run the C program
system "$bin < $i_file > $o_file";
my @processed = get_data($o_file);
cmp_deeply (\@processed, \@expected, 'results are sorted');