in reply to Re^3: Help with pushing into a hash
in thread Help with pushing into a hash
Thank again Kenosis (bows)
Well I used the code you gave me and tweaked it abit so it could do multiple files at one time so I didnt have to load the hash everytime I wanted to do multiple files. But it returns the errors:
Use of uninitialized value in list assignment at C:\Users\Jems\Desktop +\Perl\test\test2script.plx line 20. Use of uninitialized value in list assignment at C:\Users\Jems\Desktop +\Perl\test\test2script.plx line 22. Use of uninitialized value in list assignment at C:\Users\Jems\Desktop +\Perl\test\test2script.plx line 26. Use of uninitialized value in list assignment at C:\Users\Jems\Desktop +\Perl\test\test2script.plx line 27. Use of uninitialized value in list assignment at C:\Users\Jems\Desktop +\Perl\test\test2script.plx line 28.
Also, the when I run it in Padre, it gives the popup message
line 39: Substitute(s///) doesnt return the changed value even if map. Continue? Y/N.What is wrong with my code?
#!/usr/bin/perl use Modern::Perl; use File::Slurp qw/read_file write_file/; my $uniprot = 'uniprot-sfinal.txt'; my $activin = 'Activator-PFAM.txt'; my $antioxin = 'AntiOxidant-PFAM.txt'; my $toxinin= 'Toxin-PFAM.txt'; my $activout = 'ActivACNPF.txt'; my $antioxout= 'AntioxACNPF.txt'; my $toxinout= 'ToxinACNPF.txt'; my @activline; my @antioxline; my @toxinline; my %activ = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $activin; my %antiox = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $antioxin; my %toxin = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $toxinin; for ( read_file $uniprot ) { /(.{6})\s+.+=([^\s]+)/; push @activline, "$1 | $2 | $activ{$1}\n" if $activ{$1}; push @antioxline, "$1 | $2 | $antiox{$1}\n" if $antiox{$1}; push @toxinline, "$1 | $2 | $toxin{$1}\n" if $toxin{$1}; } write_file $activout, @activline; write_file $antioxout, @antioxline; write_file $toxinout, @toxinline;
The input format is still the same as before, but just more input.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Help with pushing into a hash
by Kenosis (Priest) on Aug 31, 2012 at 15:16 UTC | |
by jemswira (Novice) on Aug 31, 2012 at 15:43 UTC | |
by Kenosis (Priest) on Aug 31, 2012 at 16:37 UTC | |
by jemswira (Novice) on Aug 31, 2012 at 16:43 UTC | |
by Kenosis (Priest) on Aug 31, 2012 at 16:59 UTC | |
|