in reply to Re: Unique Variable names...
in thread Unique Variable names...
Bioinformatics#! usr/local/bin/perl -w use Cwd; use IO::Dir; use IO::File; print STDOUT "Please enter the name and location of the directory to p +arse\:\n"; chomp (my $directory=<STDIN>); open (OUTPUTFILE,">junk.txt"); my $dh = IO::Dir->new($directory) || die "Cannot open directory '$dire +ctory': $!\n"; my @filenames; push @filenames, $_ for map { "$directory/$_" } grep !/^\.\.?/, $dh->r +ead; $dh->close; @output=get_signal; for (@output){ @{$signal[0-4]}; @{$rprobe};} print OUTPUTFILE "@signal"; close OUTPUTFILE; exit; sub get_signal { while (@filename) { $file=shift @filename; use Cwd 'chdir'; chdir "./data"; open (FILE, "$file") or die; @data=<FILE>; my $i=0; foreach (@data) { next while $i++ <=14; push @signal, (split(/\t/))[3];} my $g=0; foreach (@data) { next while $g++ <=14; @probe=(split(/\t/))[0];} $hash{$file}=\@signal; close (FILE); } @values=values(%hash); $rprobe=\@probe; return @values; return $rprobe; }
|
|---|