I'm new to programming - and I though that PERL would be a great place to start (as my aim to to make my researchs groups knowlage avalible on the web - to the world as i'm sure they are all interested).
I'd like someone to take a look at my code if possible. I think that its creating an array of arrays but I'm not 100% sure. Now i know if I start putting all the sub-routines together before I know they work I'm in bother!
#!/usr/bin/perl use strict; use warnings; # subroutine to build AoA # example data from file being used # InterPro:IPR000005 Helix-turn-helix, AraC type > GO:regulation of tr +anscription, DNA-dependent ; GO:0006355 # InterPro:IPR000005 Helix-turn-helix, AraC type > GO:intracellular ; +GO:0005622 # InterPro:IPR000006 Vertebrate metallothionein > GO:metal ion binding + ; GO:0046872 # note from a VERY large file my @i2g; my @miniarray; my @i2glines; my $line; my ($ipid,$ipdesc,$godesc,$goid); open (FILE, "interpro2go.txt"); @i2glines = <FILE>; foreach $line (@i2glines) { if ($line =~ /\s*InterPro\:(\S+)\s(.+) > (.+) ; (.+)/){ my ($ipid,$ipdesc,$godesc,$goid); @miniarray = ($ipid, $ipdesc, $godesc, $goid); push @i2g, [ @miniarray ]; } } print "job done? Doing something but the correct thing?"; print @i2g; # !!!!!!!!!!! return for use to the main prog keeping AoA avaliable to + the main_processing (na other subroutine!! close FILE; exit;
What I intend to do is search this array using an array of values pulled from a hash of arrays. The key to the Hash of arrays is unique but the elements that I need to search here are not that's why I opted for the array of arrays.
Cheersjanitored by ybiC: Balanced <code> tags around code block as per Monaster convention
In reply to array of arrays by stalkeyefly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |