#!/usr/local/bin/perl -w print "Content-type:text/html\n\n"; use File::Copy; use CGI::Carp qw(fatalsToBrowser); use CGI qw(:standard); #use strict; my($jobname,$sequence,$temperature,$sodium,$folding,$magnesium,$label,$window); my(@folder_name,$temp1,$temp2); #my(@argument); $jobname = param('jobname'); $sequence = param('sequence'); $temperature = param('temperature'); $sodium = param('sodium'); $folding = param('folding'); $magnesium = param('magnesium'); $label = param('label'); $window = param('window'); open ONE,"<","/var/www/html/piRNA_html/UNAFold/output_folder_1.txt" || die "Cannot open the file"; @folder_name=; close ONE; open TWO,"<","/var/www/html/piRNA_html/UNAFold/output_folder_2.txt" || die "Cannot open the file"; push(my @folder_name,); close TWO; #print $folder_name[0],"\n", $folder_name[1]; $temp1 = pop(@folder_name); $temp2 = pop(@folder_name); if($temp1 < 30050) { mkdir "/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1",0775; open DAT,">","/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1/$jobname" || die "Can't open the file "; print DAT my $sequence; print ($temp2,$temp1,$jobname); close DAT; my $location = "/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1"; my $file1 = "unafold2.cgi"; copy $file1,$location || die "File cannot be copied."; system("chmod 777 $location/$file1"); $temp1++; open THREE,">","/var/www/html/piRNA_html/UNAFold/output_folder_2.txt" || die "Can't open the file"; #print THREE $temp1; close THREE; } else { $temp1 = 30001; $temp2++; mkdir "/var/www/html/piRNA_html/UNAFold/output/$temp2",0777; mkdir "/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1",0777; open DAT,">/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1/$jobname" || die "Can't open the file "; print DAT $sequence; close DAT; my $location = "/var/www/html/piRNA_html/UNAFold/output/$temp2/$temp1"; my $file1 = "unafold2.cgi"; copy $file1,$location || die "File cannot be copied."; system("chmod 777 $location/$file1"); $temp1++; open FOUR,">/var/www/html/piRNA_html/UNAFold/output_folder_2.txt" || die "Can't open the file"; print FOUR $temp1; close FOUR; open FIVE,">/var/www/html/piRNA_html/UNAFold/output_folder_1.txt" || die "Can't open the file"; print FIVE $temp2; close FIVE; }