Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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

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, 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
  • 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (8)
    As of 2018-06-17 23:01 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (107 votes). Check out past polls.