A few tips to get you started:
- '4d 2c 07 2c 77 b3 77 b3' isn't an array yet. By assigning it to an array variable as you did, you got an array with one element: a very long string. That probably wasn't what you intended. You'll need split to convert that string into an actual array.
- Perl has two different ways to loop through array elements: for my $element (@somearray) {...} and for (setup counter; test counter; increment counter), as in C. You'll have to decide which is better to use.
- When you loop through the array elements to print out each line, be careful about array indexes, especially the choice of the last one.
- Put use strict;use warnings; at the top of your script if you haven't already. You'll have a better shot of knowing if you made a mistake in your choice of array indexes.
- And don't forget hex