in reply to Re^3: create array of empty files and then match filenames
in thread create array of empty files and then match filenames

What is in $confs ?

I'm guessing you need to use split to create @confs

#!perl use strict; my $confs = 'B001, B003, B002'; my @confs = split /, /,$confs; my @sortedconfs = sort {$a cmp $b} @confs; print "@sortedconfs\n";
poj

Replies are listed 'Best First'.
Re^5: create array of empty files and then match filenames
by angela2 (Sexton) on Jan 14, 2016 at 16:16 UTC

    Hi, thanks for the reply! So, the variable $confs is my numbered chemical conformations, in the form of 4 characters long in the style of B001, B002, B003 and so on. They are in my filenames along with other similar ones. The result is something like MOLEC1-B001-OPT-FREQ2.gout or MOLEC2-B010-OPT-FREQ2.gout or MOLEC8-B040-OPT-FREQ2.gout and so on. Does that make sense? I don't know how many conformations I'll get in the end, as I'm optimising my molecules now. I don't know if I've managed to explain it at all... In my case I don't think split would be useful, on the other hand I'm learning so I may be wrong.

    edit: You're right that the array @confs isn't populated correctly. I print its contents and there's only one file that it finds, when I have 5 of them in the directory. So I have to find a way to put all elements in the array and not only one.