Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: if condition within moduleby wjw (Priest) |
on Aug 15, 2017 at 15:11 UTC ( [id://1197437]=note: print w/replies, xml ) | Need Help?? |
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:
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 Section
Seekers of Perl Wisdom
|
|