#/bin/perl/ use strict; #test only for file 1M01_F00121.npt.gro my $file = /(1M01)(\_)(F)(\0+)(121)/; print $file; # for testing `grompp -f input.mdp -c "$file".npt.gro -p topol.top -o "$file".md.tpr`; #### #/bin/perl/ use strict; my $i; #now loop through all the files in the directory for ($i=121; $i<=150; $i++) { my $file = /(1M01)(\_)(F)(\0+)($i)/; print $file; # for testing `grompp -f input.mdp -c "$file".npt.gro -p topol.top -o "$file".md.tpr`; }