Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Print subroutine problem

by NetWallah (Canon)
on Apr 05, 2013 at 17:58 UTC ( #1027185=note: print w/replies, xml ) Need Help??

in reply to Print subroutine problem

You need to fix your "print" statements inside your GetOptions processing to format the output. Eg:
'activeconn' => sub { print "Active_Conn:" . query_database($querys{activeconn}) . " "},
Add printing of a "\n" after you finish "GetOptions".
Also, the final test should be for "@ARGV", not "$ARGV".

Update: Noticed that CountOrlok beat me to it, with almost identical advice.

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs

Replies are listed 'Best First'.
Re^2: Print subroutine problem
by Shivaramakrishnan (Initiate) on Apr 05, 2013 at 18:40 UTC

    Thanks a ton!! That worked

Re^2: Print subroutine problem
by Shivaramakrishnan (Initiate) on Apr 05, 2013 at 18:47 UTC

    I wanted to know is there a way to modify my current script to accept ip address of the database server (in script used as hostname) as an arguement since I am implementing this over multiple database servers and don't want to statically define an IP.

      Just the way you have the line 'database=s' => \$database, you can add a line for $hostname.

      Also, look into making your usage statement better, i.e. tell users that they can also pass --user, --database, etc. in the command line.

      Just a side note, it hurts my eyes seeing the word "querys". Someone is going to get an error if they type the correct pluralization in the script.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027185]
[marto]: good morning all

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2018-06-20 08:35 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.