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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


New User

Jan 17, 2013, 3:11 AM

Post #1 of 2 (1571 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

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?

Veteran / Moderator

Jan 17, 2013, 5:02 AM

Post #2 of 2 (1563 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:

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