you did not say that there could be several substrates on the same line, you said there could be several products on product lines, but you did not say it for substrates.

The code I provided and the one by Chris therefore does not look for possibe other substrate on the substrate line. And you code, probably derived in part from what Chris and myself have suggested, also doesn't check for other substrates on substrate lines.

You have to change the second and third lines of this part of your code to look for possible other substrates:

Yes, Laurent found the problem - you need to check for more than 1 substrate on it's line. In addition, when I ran the code you posted, I found other errors but I haven't been able to find the cause. Here is my code modified from my original post. It checks for more than 1 substrate (on 1 line).

Hi Chris, I have 10 directories and each of them has a file "list". I modified your code to create pairwise concatenated matrices but Im getting this error --"No such file or directory at code2.pl line 6", whereas the file does exist. Here's the code :-

Assuming code2.pl is your program and that you are launching it from the directory, everything seems OK, the file permissions should enable you to open the 2 SUPERLIST files.

I do not understand why opening these files should fail. Can you view your SUPERLIST files with the cat or more commands? I'm asking because there is sometimes an invisible or hidden character in file names.

probably does not do what you seem to think it does, although I am not entirely sure of what you are trying to do with it. Add a print on @file or use the debugger to figure out the contents of the @file array.

If you want a list of files in directory dirs[$i], you may want to use the glob function or you could do something like this:

The way you have set up the for loops is wrong, (I'll show below), and does not interface with the rest of the program. I believe you want the pairings of each matrix, (and not the matrix by itself). That seems to be the intention of your attempt to solve the problem.

You also have other issues which you have been discussing with Laurent. How to find the files, etc.

To find all pairs, I set up a table from 1 to 5, (instead of 1 to 10), just to demonstrate combinations.

Hi Laurent. I dont want to list all the files in each of the ten directories. "list" is actually the name of the file. "list" is the only file I'm concerned about (the file "list" resides in each of the ten directories). The code will select first directory and then takes its "list" file,generate matrix and concatenate it with the "list" file generated matrix of second directory. Pairwise matrices ,that is.

Laurent, see the problem is that the values of dirs (i.e. the @dirs) are getting displayed(as shown by the debug code), but the file "list" inside each of these directories are not being read. So Im still getting this error :-

Code

Unable to open $dirs[$i]/list for reading. No such file or directory at code2.pl line 33.

And yes , there aint no point in comparing 1 with 1 (and so on), that was just to explain you the problem scenario.

Sorry, my error. There is an improvement, since the variables are now interpolated, but the two files names get stored in the first element of the array, because qq// makes a single string, not a list of strings.

Try this instead:

Code

my @file = ($dirs[$i]/list, $dirs[$j]/list );

Actually, you could also open directly "$dirs[$i]/list" and $dirs[$j]/list, but if you find it more convenient to create a temporary array with the two files, then the syntax above should work.

Bareword "list" not allowed while "strict subs" in use at code2.pl line 29. Bareword "list" not allowed while "strict subs" in use at code2.pl line 29. Execution of code2.pl aborted due to compilation errors.

Hi Laurent. Finally the code is running fine,though the output file is huge,but that's not an issue as the format is what I wanted. But a strange error keeps popping up after 10 minutes of running the code ( a complete run for 10X10 would take around 20 minutes)

Code

$ perl code2.pl >> 10_X_10.txt Use of uninitialized value within @file in concatenation (.) or string at code2. pl line 63. Use of uninitialized value in concatenation (.) or string at code2.pl line 63.