Captainrave
Technical User
How do i change this script so that it will ask the user what the filename is rather than having to go into the code each time and change the path of the filename?
The code is:
THANKS!!!!!
The code is:
Code:
use strict;
use warnings;
open(OUTPUT,"+>insertorganismname_REPEAT_DISTRIBUTION.csv");
open BIG, 'f:\PhD\Data (D)\Scripts\Repeatdistribution\BOGAR_CDS_LOCATION.xls' or die "$!";
my @big = map {[split/\s+/]} <BIG>;
close BIG;
open SMA, 'f:\PhD\Data (D)\Scripts\Repeatdistribution\BOGAR_REPEAT_LOCATION.csv' or die "$!";
LOOP: while (<SMA>) {
my ($s,$e) = split(/\,/);
foreach my $array (@big) {
if ($s >= $array->[0] && $e <= $array->[1]) {
calculate($s,$e,$array->[0],$array->[1],$.);
next LOOP;
}
}
}
close SMA;
close OUTPUT;
exit;
sub calculate {
my ($small_start, $small_end, $big_start, $big_end, $line_num) = @_;
my $calculation = ( ( ($big_start/$big_end) / ($small_start/$small_end) ) * 100 );
print OUTPUT "small_start,$small_end,$big_start,$big_end,$calculation,/n";
}
THANKS!!!!!