Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: need help urgent using @ARGV

by ww (Bishop)
on Jan 19, 2012 at 03:57 UTC ( #948669=note: print w/ replies, xml ) Need Help??


in reply to need help urgent using @ARGV

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.


Comment on Re: need help urgent using @ARGV
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://948669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2014-09-19 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls