Hello Monks

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.

Cheers
Stalky

janitored by ybiC: Balanced <code> tags around code block as per Monaster convention


In reply to array of arrays by stalkeyefly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.