Could anybody please help me why I got this error message? Use of uninitialized value $_[0] in pattern match (m//) at ModuleMatching.pm line 11, <> line And this is the line I am matching LOCUS AB007147 460 bp DNA linear PRI 08-FEB-2002 it worked without the subroutine. Thanks a lot! Here is the code: ##########################################
use lib "/d/user2/aszend01/BCII/240213"; use ModuleMatching; my $locus_acc_no; while (my $line = <>) { # locus_acc_no if ($line =~ ModuleMatching::MatchLAC($locus_acc_no)) { unless (ModuleMatching::MatchLAC($locus_acc_no)){ print "something is wrong with the matching", "\n"; next; } } print $locus_acc_no, "\n"; } # This module will be called from the myparserM.pl. It will pull out t +he locus_acc_no. package ModuleMatching; use strict; # Here are the matchig code for the locus_acc_no (LAC) sub MatchLAC($) { return $_[0] =~ /^LOCUS\s{7}(\w+)\s+\w+/; } 1;
######################################################### And here is the file I want to do the matching: ####################################################### LOCUS AB007147 460 bp DNA linear PRI 08-FEB-2002 DEFINITION Homo sapiens gene for ribosomal protein S2, partial cds. ACCESSION AB007147 VERSION AB007147.1 GI:3077742 KEYWORDS ribosomal protein S2. SOURCE Homo sapiens (human) ORGANISM Homo sapiens Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; Mammalia; Eutheria; Euarchontoglires; Primates; Haplorrhini; Catarrhini; Hominidae; Homo. REFERENCE 1 AUTHORS Kenmochi,N., Kawaguchi,T., Rozen,S., Davis,E., Goodman,N., Hudson,T.J., Tanaka,T. and Page,D.C. TITLE A map of 75 human ribosomal protein genes JOURNAL Genome Res. 8 (5), 509-523 (1998) PUBMED 9582194 REFERENCE 2 (bases 1 to 460) AUTHORS Kenmochi,N. TITLE Direct Submission JOURNAL Submitted (10-SEP-1997) Naoya Kenmochi, Miyazaki Medical College, Central Research Laboratories; 5200 Kihara, Kiyotake, Miyazaki 889-1692, Japan (E-mail:kenmochi@post.miyazaki-med.ac.jp, Tel:81-985-85-9665, Fax:81-985-85-1514) FEATURES Location/Qualifiers source 1..460 /organism="Homo sapiens" /mol_type="genomic DNA" /db_xref="taxon:9606" /chromosome="16" /map="16p13.3" CDS join(<1..73,300..>460) /codon_start=1 /product="ribosomal protein S2" /protein_id="BAA25813.1" /db_xref="GI:3088335" /translation="LLMMAGIDDCYTSARGCTATLGNFAKATFDAISKTYSYLTPDLW KETVFTKSPYQEFTDHLVKTHTRVSVQRTQAPAV" exon <1..73 /product="ribosomal protein S2" intron 74..299 exon 300..>460 /product="ribosomal protein S2" ORIGIN 1 ctgctcatga tggctggtat cgatgactgc tacacctcag cccggggctg cactgccacc 61 ctgggcaact tcggtaggtg gtccacacat ggggcatagc catggtctct cagctccgct 121 taaccacacg ggtccagtgt gtgcttggcg tgttttcagg gaggcagaga aaggctctcc 181 taatgnacga cagacccgcc cagaatggcc tctctgttcc taggagtgcg acaatttttg 241 ggttggggga cttgcctcaa gcacaccact gaccctcctg gggttctttt gttttgcagc 301 caaggccacc tttgatgcca tttctaagac ctacagctac ctgacccccg acctctggaa 361 ggagactgta ttcaccaagt ctccctatca ggagttcact gaccacctcg tcaagaccca 421 caccagagtc tccgtgcagc ggactcaggc tccagctgtg //

In reply to matching problem by Balaton

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.