bioinformatics has asked for the wisdom of the Perl Monks concerning the following question:
Thank you all for your time and thoughts!!!#! usr/local/bin/perl use Cwd; print STDOUT "Please enter the name and location of the directory to p +arse\:\n"; $directory=<STDIN>; 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=<FILE>; $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 wor +k close (FILE); } @values=values(%hash); return @values; } sub get_targets { $target=shift @genius; use Cwd 'chdir'; chdir "./data"; open (FL, "$target") or die; @info=<FL>; $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 variabl +e, which doesn't work. print @next_columns; print OUTPUTFILE "@final_data"; close OUTPUTFILE; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unique Variable names...
by dragonchild (Archbishop) on Jul 29, 2003 at 18:48 UTC | |
by BUU (Prior) on Jul 30, 2003 at 00:51 UTC | |
by dragonchild (Archbishop) on Jul 30, 2003 at 13:41 UTC | |
by bioinformatics (Friar) on Jul 30, 2003 at 15:49 UTC | |
by Limbic~Region (Chancellor) on Jul 30, 2003 at 15:59 UTC | |
by bioinformatics (Friar) on Jul 30, 2003 at 19:50 UTC | |
|
Re: Unique Variable names...
by CountZero (Bishop) on Jul 29, 2003 at 19:15 UTC | |
by bioinformatics (Friar) on Jul 29, 2003 at 19:42 UTC | |
by CountZero (Bishop) on Jul 30, 2003 at 19:48 UTC | |
|
Re: Unique Variable names...
by LameNerd (Hermit) on Jul 29, 2003 at 18:31 UTC |