sub create_file_for_batch{ if($dest ne "" && $source ne "" && $logpath ne "" && length($sourcetext)!=1){ $sourcetext=$sourcetextentry->get('1.0','end'); $original_dest = $dest; $dest =~s/\//\\/g; $original_source = $source; $source =~s/\//\\/g; $switches=""; save_switches(); print LOG ("The destination path was: $dest\n The source path was: $source\n The path for the log file is: $logpath\n The users are: $sourcetext\n"); @arraybatch = split /,|\n/, $sourcetext;#splits what is in the variable $len = @arraybatch; for($i=1; $i<$len; $i=$i+2){ $arraybatch[$i] =~s/\G //g;#gets rid of the space in front $arraybatch[$i] =~s/ /_/g;#put _ in place of the space between the name push @arrayfilename, $arraybatch[$i]; }#for for($i=0; $i<$len; $i=$i+2){ push @arraydirectory, $arraybatch[$i]; }#for @sortedarraydirectory = @arraydirectory;#makes a copy of the arraydirectory so I can sort @sortedarraydirectory= sort @sortedarraydirectory;#sort the copied array $len = @sortedarraydirectory; for ($i=0; $i<$len; $i++){ if ($sortedarraydirectory[$i] ne $sortedarraydirectory[$i+1]){ make_table(); $notebook->pageconfigure('page1', -state=>'normal'); $notebook->pageconfigure('page2', -state=>'normal'); }else{ $dialog = $page3-> Dialog( -title => 'Alert', -text => "$sortedarraydirectory[$i] is a duplicate. Please correct the batch file.", -buttons => [ qw(OK) ]) ->Show(); }#else }#for }else{ $dialog = $page3-> Dialog( -title => 'Alert', -text => "Please enter paths for destination, sources and log file and fill out the text area for batching", -buttons => [ qw(OK) ]) ->Show(); }#else }#create_file_for_batch