CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Need help regarding parsing out put

 



sandeepda
New User

Jan 17, 2013, 3:11 AM

Post #1 of 2 (625 views)
Need help regarding parsing out put Can't Post

I am executing a command it is returning me something like this

name ip port
------------------------------------
http-listener-1 * 6712
http-listener-2 * 8709

Code
 
I have a subroutine 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 is 4516..I want to return an array a[0]=FALSE and a[1]=null

How can i parse this output.Any help appreciated?


Laurent_R
Veteran / Moderator

Jan 17, 2013, 5:02 AM

Post #2 of 2 (617 views)
Re: [sandeepda] Need help regarding parsing out put [In reply to] Can't Post

I don't quite understand what you want. Are yau asking how to retrieve the values returned by the subroutine?

If such is the case, simply do something like this:


Code
my ($valid, $listener) = getListenerName($porttobeChecked) ;


If not, please explain further.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives