On *nix, I don't need to do <<`EOL`, i.e. <<EOL will do

That's not true. Taking the same code,

open(OUTPUT, " > eol_dos.out") or die $!; print OUTPUT <<EOL; dir EOL
>ver Microsoft Windows XP [Version 5.1.2600] >perl a.pl && type eol_dos.out dir
open(OUTPUT, " > eol_dos.out") or die $!; print OUTPUT <<EOL; ls -1 EOL
$ uname Linux $ perl a.pl && cat eol_dos.out ls -1

The sqlplus is working on *nix but not on Windows

No. Like I said in my previous post, your sh shell command works in sh but not in cmd.

I do not want to fork a separate shell as well so I took it off the bash.

But that's you're doing. You're asking Perl to execute shell command

sqlplus -S "/as sysdba" <<"SQLEND" set heading off alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS' ; select 'Connected to the database on ' || sysdate from dual ; SQLEND
so it launches a shell to execute it.

Any suggestion on the sqlplus thing for Windows will be very much appreciated.

Yes, stop invoking the shell. Create a pipe to sqlplus and pipe the data to it instead of asking the shell to do that.

Ideally, that would be

my @cmd = ( sqlplus => ( '-S', '/as' => 'sysdba', ) ); open(my $to_sqlplus, '|-', @cmd) or die("Can't launch sqlplus: $!\n"); print $to_sqlplus <<'__EOI__'; ... __EOI__ close($to_sqlplus);

But no-one has gotten around to implementing multi-arg open |-. So you can use

use IPC::Open2 qw( open2 ); my @cmd = ( sqlplus => ( '-S', '/as' => 'sysdba', ) ); local *TO_SQLPLUS; my $pid = open2('>&STDOUT', *TO_SQLPLUS, @cmd) or die("Can't launch sqlplus: $!\n"); print TO_SQLPLUS <<'__EOI__'; ... foo bar ... __EOI__ close(TO_SQLPLUS); waitpid($pid,0);

BTW, out of curiosity, do you type in your comments/reply typing <p> and </p> manually as well?

Yes. Well not </p>. It's optional in HTML.


In reply to Re^5: Using <<EOL > output.out and EOL by ikegami
in thread Using <<EOL > output.out and EOL by newbie01.perl

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.