Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

You're most welcome, jemswira! (And, if you need to bow, bow only to Perl... :)

The errors suggest a failed regex in one or more of the map statements. Here are the lines where the errors occurred:

my %activ = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $activin; # Line 20 my %antiox = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $antioxin; # Line 21 my %toxin = map { s/\.\d+//g; /(.+)\s+\|\s+(.+)/; $1 => $2 } read_fil +e $toxinin; # Line 22 for ( read_file $uniprot ) { # Line 23 /(.{6})\s+.+=([^\s]+)/; # Line 24 push @activline, "$1 | $2 | $activ{$1}\n" if $activ{$1}; # Line 2 +6 push @antioxline, "$1 | $2 | $antiox{$1}\n" if $antiox{$1}; # Lin +e 27 push @toxinline, "$1 | $2 | $toxin{$1}\n" if $toxin{$1}; # Line 2 +8 }

Sounds like there may be lines in the files with differently-formatted data that the regex fails to match. To see if this is the case, try the following:

for my $file (qw/Activator-PFAM.txt AntiOxidant-PFAM.txt Toxin-PFAM.tx +t/){ for(read_file $file){ say "No Match in File: $file; Line: $_" if !/(.+)\s+\|\s+(.+) +/; } }

This will go through each file and display any line the regex doesn't match. If lines with data on them show, the regex will need to be adjusted. If empty lines show, e.g.,:

No Match in File: test2.txt; Line:

Try adding a grep before the file read that allows only non-blank lines to pass. For example:

my %data = map {s/\.\d+//g; /(.+)\s+\|\s+(.+)/ and $1 => $2 } grep /\S +/, read_file $test2;

If no lines show, I'm not sure what the issue may be. In any case, however, please get back to me or the Monks...


In reply to Re^5: Help with pushing into a hash by Kenosis
in thread Help with pushing into a hash by jemswira

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (9)
    As of 2014-09-18 23:29 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (126 votes), past polls