Calling Files automatically
From: Edward Wijaya (ewijaya_at_singnet.com.sg)
Date: 02/25/05
- Next message: Benjamin Jeeves: "lwp-download"
- Previous message: Marcos Rebelo: "Re: Reading and writing to a program"
- Next in thread: Wiggins d'Anconia: "Re: Calling Files automatically"
- Reply: Wiggins d'Anconia: "Re: Calling Files automatically"
- Reply: Charles K. Clarkson: "RE: Calling Files automatically"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Feb 2005 10:22:56 +0800 To: "beginners@perl.org" <beginners@perl.org>
Hi,
How can I modify the early part of code below
such that I don't have to manually key in the files this way:
perl mycode.pl data1P.fa data1R.fa data2P.fa data2R.fa ....etc
I.e. just by typing this will do:
perl mycode.pl
Thanks so much for your time beforehand.
--
Edward WIJAYA
Singapore
__BEGIN__
#!/usr/bin/perl
use strict;
use warnings;
for (@ARGV) {
next if /P\./; # ignore the P files
my ($base, $ext)= split /R/; #assume only one 'R' in the file name
r_p_process ( $base."R".$ext, $base."P".$ext )
}
sub r_p_process {
my $r_file=shift;
my $p_file=shift;
print "processing the pair $r_file $p_file\n";
#then process two files
}
__END__
NOTE:
The code above take pair-series of files as follows:
data1R.fa - data1P.fa
data2R.fa - data2P.fa
From list of files in directory
data1R.fa
data2P.fa
data2R.fa
data2P.fa
.... #and there are more than 40 of these type files
- Next message: Benjamin Jeeves: "lwp-download"
- Previous message: Marcos Rebelo: "Re: Reading and writing to a program"
- Next in thread: Wiggins d'Anconia: "Re: Calling Files automatically"
- Reply: Wiggins d'Anconia: "Re: Calling Files automatically"
- Reply: Charles K. Clarkson: "RE: Calling Files automatically"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|