in reply to Column Comparison of a File in Perl

Your first problem is definitely the easiest. To loop over each line of the file, use while (<>) like so:

open my $outfile, '>', 'out.txt'; while (<>) { print $outfile $_ if /^(?:A id|M X)/; } close $outfile;

Obviously you may need a more rigorous regular expression, but this works for your example data. Your second problem is more difficult, so it'll have to wait for now.

Update: On second glance, your second probem is not well stated. What kind of comparison do you want to do? What should the output look like? Afraid I can't help with a poor problem statement.


print map{substr'hark, suPerJacent other l',$_,1}(11,7,6,16,5,1,15,18..23,8..10,24,17,0,12,13,3,14,2,4);