We don't bite newbies here... much | |
PerlMonks |
Re: if condition within moduleby kcott (Archbishop) |
on Aug 16, 2017 at 07:24 UTC ( [id://1197491]=note: print w/replies, xml ) | Need Help?? |
G'day gowthamvels,
The very first thing you should do is read "Perl introduction for beginners" because, from what you've demonstrated, you do not, at present, have a basic understanding of Perl code syntax. if can be used in a compound statement. The construct looks like this:
That may be followed by zero or more alternative conditions and actions:
Finally, all of that may be optionally terminated with:
This is documented in "perlsyn: Compound Statements". if may also be used as a statement modifier:
This is documented in "perlsyn: Statement Modifiers". There is also an "if pragma". This does not appear to have anything to do with what you're currently attempting; however, be aware of it to avoid confusion in other (unrelated) code, discussions or documentation. Perl has no builtin if() function. I mention this because "if()" has been used in a number posts in this thread (including by yourself: "I am asking for how to use the if() in this code") and that usage could be confusing to a Perl novice. — Ken
In Section
Seekers of Perl Wisdom
|
|