#!/bin/perl/ use strict; use warnings; my $molec1 = "molec1"; my $molec2 = "molec2"; my $input1; my $input2; @ARGV = (); my $i; my $j; my $path = "/store/group/comparisons"; my $line; my @columns; my $nextUnless = 2; # nr of lines to skip from beginning my $CountLines = 0; # total nr of lines in all files, including comments for ($i=1; $i<=3; $i++) { open $input1, '<', "$path\/File-${molec1}-cluster${i}.out" or die $!; for ($j=1; $j<=4; $j++) { open $input2, '<', "$path\/File-${molec2}-cluster${j}.out" or die $!; push @ARGV, $input1; push @ARGV, $input2; my @list; my $list; my $a; my $b; while ($line = <>) { $CountLines += 1; next unless $. > $nextUnless; chomp $line; $line =~ s/^\s+|\s+$//g; push @list, [split/\s+/, $line]; @columns = split /\s+/, $line; } close $input1; close $input2; for ($a=0; $a<=$#columns; $a++) { for ($b=0; $b<=$#columns; $b++) { print "$list[$a][$b] "; # to check matrices } print " \n"; } } # for j } # for i