Calling Files automatically

From: Edward Wijaya (ewijaya_at_singnet.com.sg)
Date: 02/25/05


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


Relevant Pages

  • RE: Calling Files automatically
    ... Edward Wijaya wrote: ... How can I modify the early part of code below such that ... : I don't have to manually key in the files this way: ... Charles K. Clarkson ...
    (perl.beginners)
  • Re: pattern matching
    ... If your system is set up properly then you can run a perl script simply by ... typing it's name on the command line. ... To modify text people often use the 's' function ... pavanThere Iam fine ...
    (comp.lang.perl.misc)
  • Re: Editing location in Calendar
    ... For those who can edit the registry, modify ... "Brooke" wrote in message ... > I have made a mistake in typing a place in location in Calendar and ...
    (microsoft.public.pocketpc)
  • does VxWorks save settings ?
    ... typing the routeShow command) somewhere? ... I modify them, and when I reboot, it is not modified. ...
    (comp.os.vxworks)
  • Re: File Date
    ... > original date after I modify a file and save it under a new name? ... e.g. by typing this into the search window: ... Prev by Date: ...
    (microsoft.public.windowsxp.general)