#!/usr/bin/perl/ use strict; use warnings; my $tpr = "tpr"; my $id; my $filepath; my $batch; my $number; my $molec; my $frame; my $mdstep; my @tpr; @tpr = `ls *.tpr`; print "Script start \n"; print "\n"; foreach (@tpr) { /(\w{2})(\d{4})_F(\d{5})_S(\d{5})/; $id = "AC"; $molec = $2; $frame = $3; $mdstep = $4; for ($molec=2; $molec<=2; $molec++) { for ($frame=1; $frame<=2; $frame++) { my $molecform = sprintf ("%04d", $molec); my $frameform = sprintf ("%05d", $frame); print "$id${molecform}_F${frameform}_S${mdstep}\.$tpr \n"; } } } # end of loop through tpr files