#! usr/local/bin/perl use Cwd; print STDOUT "Please enter the name and location of the directory to parse\:\n"; $directory=; chomp $directory; open (OUTPUTFILE,">junk.txt"); opendir (DIR, "$directory") or die "Failed to open directory: $!"; @filename=readdir(DIR); @trash=splice(@filename, 0,2); @genius=@filename; sub get_signal { while (@filename) { $file=shift @filename; @final_data=''; use Cwd 'chdir'; chdir "./data"; open (FILE, "$file") or die; @data=; $spliced_data=splice(@data, 1, 14); foreach (@data) { ($a, $b, $c, $d, $e, $f)=split(/\t/); push(@final_data, "$d\n");} %hash={"$file"=>@final_data}; #this hash assignment +doesn't work close (FILE); } @values=values(%hash); return @values; } sub get_targets { $target=shift @genius; use Cwd 'chdir'; chdir "./data"; open (FL, "$target") or die; @info=; $excess=splice(@info, 1, 14); foreach (@info) { ($z, $x, $w, $y, $u, $v)=split(/\t/); push(@targets, "$z\n");} close (FL); return @targets; } @column=get_targets; @next_columns=get_signal; for ($i=0;$i<=scalar(@next_columns);$i++) { @$i=@next_columns[$i];} #my attempt at assigning a +unique variable, which doesn't work. print @next_columns; print OUTPUTFILE "@final_data"; close OUTPUTFILE; exit;