Edward WIJAYA <[EMAIL PROTECTED]> wrote: : On Fri, 25 Feb 2005 09:10:54 -0600, Charles K. Clarkson : <[EMAIL PROTECTED]> wrote: : : : Is it always data1, data2, data3, etc. or can data be : : another word? (Like foo1, foo2, foo3, etc.) : : : : it always comes in (R-P) pair: : data1R.fa : data1P.fa : foo1R.fa : foo1P.fa : bar2R.fa : bar2P.fa : : : So "data1R.fa" is always processed with "data1P.fa", and so : forth. : : : : Is the extension always .fa or can it be something else? : : Yes the extension is always ".fa"
Then the original script could be rewritten to this. Only the "R" files needed to be supplied. # ARGV need only contain "R" files. foreach my $r_file ( @ARGV ) { next unless $r_file =~ /(.*)R.fa$/; r_p_process( $r_file, "$1P.fa" ); } : : Will every R file have a matching P file or will : : some extra files be located in the directory? For example, : : will there sometimes be a data14R.fa file and no : : corresponding data14P.fa file? : : No, there will always be a corresponding file. : i.e. *R.fa always have its *P.fa file : : : : : : : Will there be other files located in this directory? : : Yes, but they won't be any other *R.fa *P.fa type. Look up the use of the 'glob' function included in perl. The perlfunc file has info on it. The angle brackets act as a shortcut. Something like <*R.fa> should point you in the right direction. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>