Hi,

I tried out the following and am getting errors for the one on Micro$oft. Any chance of any monks telling me what am I doing wrong.

The original sugggested code is as below:

open my $bash, "|-", "bash >/tmp/out.txt" or die $!; print $bash <<EOL; ls df -h uname -a EOL

I took out the |- and "bash ..." because I want to be able to do this for both Unix and Windows. I assume you cannot do |- on Windows, is that a correct assumption? If anyone can please tell me why am getting the error for the sqlplus under DOS:, it will be very much appreciated. Thanks in advance.

Codes below, all is working except for sqlplus under DOS.

DOS: OS Command - works OK: open(OUTPUT, " > eol_dos.out") or die $!; print OUTPUT <<`EOL`; dir EOL exit 0; sqlplus - this gives error : << was unexpected at this time. $ENV{'ORACLE_SID'}="TEST"; $ENV{'ORACLE_HOME'}="C:\oracle\product\10.2.0"; open(OUTPUT, " > eol_sqlplus_dos.out") or die $!; print OUTPUT <<`EOL`; 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 EOL exit 0 UNIX: OS Command - works OK: open(OUTPUT, " > eol_unix.out") or die $!; print OUTPUT <<`EOL`; ls echo echo "+----------------------------------------------+" echo df echo echo "+----------------------------------------------+" echo uname -a EOL exit 0; sqlplus - works OK: $ENV{'ORACLE_SID'}="test"; $ENV{'ORACLE_HOME'}="/oracle/product/10.2.0"; open(OUTPUT, " > eol_sqlplus_unix_02.out") or die $!; print OUTPUT <<`EOL`; echo "Today is `date`" echo echo "+----------------------------------------------+" echo 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 echo echo "+----------------------------------------------+" echo EOL exit 0

In reply to Re^2: Using <<EOL > output.out and EOL by newbie01.perl
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.