Perhaps your question is a bit unclear because of the terminology you are using. I am assuming that you are pretty new to Perl(and perhaps programming in general?).

I am not familiar with Data::Table, so will offer my suggestion outside the scope of what it might be capable of. You can use an if statement pretty much anywhere in your code that you wish: In a sub, in a module, it does not matter. Based on what you state that you want, a code snippet that would work might look like the following:

if ($col6 =~ /^\Q97517\E/ ) { --do somethng -- } elsif ($col6 =~ /^\Q97516\E/) { --do something else -- }

The --do something(s) -- can be what whatever you want them to be.

If you are up against a time constraint, such as an assignment due, it will be much faster to look in the documentation for Data::Table. There is an example about half way down that shows the use of an if() conditional.

There is no better way to learn Perl and programming in general than to take a problem one wants to solve and figure out how to solve that problem using the language. But you have to take the time to learn the terminology so that you can ask questions which are clear when seeking help. Learning takes time, and time constraints are not conducive to learning programming in my experience....

...the majority is always wrong, and always the last to know about it...

A solution is nothing more than a clearly stated problem...


In reply to Re: if condition within module by wjw
in thread if condition within module by gowthamvels

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.