Hmm, I've got more comments than just an answer to your question.
my ($sec,$min,$hour,$day,$month,$yr19,@rest) = localtime(time);##### ##To get the localtime of your system print "Date:\t$day-".++$month. "-".($yr19+1900)."\n"; ####To print dat +e format as expected print "Time:\t".sprintf("%02d",$hour).":".sprintf("%02d",$min).":".spr +intf("%02d",$sec)."\n";###To print the current time
Why are you not simply using strftime in POSIX? It is like using sprintf but for date and time formats. It can format the time any way you want without you having to tweak the fields from localtime, first.

And even if you decide not to, it's still clearer to use a single sprintf (or printf) call, instead of concatenating results of several calls.

printf "Time:\t%02d:%02d:%02d\n", $hour, $min, $sec;###To print the cu +rrent time
$SQLPLUS = "C:/sqlplus.exe";
You're hardcoding a single location, instead of letting Windows find it in your PATH.

You can check if it exists by using:

$version = `sqlplus -V`;
Either that will succeed, putting a string with a version number in $version, or it'll fail, returning undef and probably setting $? too to a nonzero value.

If you insist of finding exactly where SQLPLUS is, take a look at `which` (for Windows) in pure perl, which implements a Pure Perl snippet for finding an executable in PATH.

The code to run the sqlplus.exe.......shoud be here
Like I showed just above, you can use backticks (AKA qx), which will capture the STDOUT of the program; you call system which will let STDOUT go its usual way; or you can use one of a few modules, like IPC::Open2, IPC::Open3, IPC::Run. You can even use open with a trailing "|" after the command line, to read STDOUT from the running program. Oh, and on Windows, you can use Win32::Process too, which will not wait for the invoked program to finish, to resume execution of your script. Choices, choices...

In reply to Re: How to run a .exe file from a Perl script? by bart
in thread How to run a .exe file from a Perl script? by Ethen

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.