Please clarify the narrative portion of your SOPW -- which may be achieved, in some part, by using conventional grammar, syntax and punctuation (AKA "complete sentences with capitalization and punctuation").

Aside: it appears that what you tell us up to the words "suppose my code is in backup.pl is irrelevant to the question you didn't ask but that, on a WAG, may be, "how do I revise this code to use..." perl backup.pl -i servername -d databasename

Of course, the code you show offers very little support for (or "relevance to") my WAG, so maybe you'd better clarify your thinking... and then your question.

And, for the benefit of others with better brains, less time or patience, here's what your (posted) code is apparently supposed to look like:

use strict; use Win32::SqlServer qw(SCALAR); print "Please enter DB name:\n"; my $name = <STDIN>; chomp($name); # Log in to server . my $sqlsrv = Win32::SqlServer::sql_init('localhost', 'geff', 'gentle', + 'Northwind'); # Our SQL statement. my $stmnt = <<SQLEND; BACKUP database "$name" TO DISK = N'c:\\bak\\master.dmp' SQLEND # Run query. my $result = $sqlsrv->sql($stmnt, SCALAR); # Print results. foreach my $name (@$result) { print "$name\n"; }

Update, clarifying: That is, that's what the code would have looked like if you'd bothered reading the advice about formatting in Writeup Formatting Tips. That is NOT to say it's anything even close to good code.


In reply to Re: need help urgent using @ARGV by ww
in thread need help urgent using @ARGV by mohan@1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.