Sorry I am beginner in perl just starting hence if there are mistake please oblige.
Here is the problem
I am executing subroutine in perl script it returns me output dynamically in array format @outputArray
outputarray[0]=name ip port
outputarray[1]=------------------------------------
outputarray[2]=http-listener-1 * 6712
outputarray[3]=http-listener-2 * 4743
I can also get the output array as like below also if i want
outputarray[0]=http-listener-1 * 6712
outputarray[1]=http-listener-2 * 4743
I want to write a subroutine which will check whether port exists and if exists returns me true and the listener name if not it returns me false and null
getListenerName($porttobeChecked) This subroutine returns me the name of the listener if i pass a port. Eg: If $porttobechecked=6712 I want to return an array a[0]=TRUE and a
1=http-listener-1(listener name) If port to be checked = 4516.I want to return an array a[0]=FALSE and a
1=null .Help required
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.