develooper Front page | perl.beginners | Postings from April 2010

Help on using << on *nix and Windows

Thread Next
From:
newbie01 perl
Date:
April 19, 2010 02:21
Subject:
Help on using << on *nix and Windows
Message ID:
z2tb74aaa0f1004190221w6fe3daa7k5cbaeb44bc83ded1@mail.gmail.com
Hi all,

I need to convert a lot of UNIX scripts into Perl. Most of them uses the
UNIX's EOF/EOL functionality. These scripts are mostly used to connect to
Oracle databases. At the moment, installing a DBI is not an option. The
scripts will be running locally on the servers so technically it should be
able to connect to the database without using a password.

Example of a very simple test script is as below. If I run the script on
UNIX, it is all good. But on Windows, it gives the error "<< was unexpected
at this time." Can anyone please advise what I needed to change to get both
running for UNIX and Windows?

Thanks in advance.

Sample test code below:


sub test_01()
{
   print "+-------------------------------------+ \n";
   print "Running :: sub test-01 !!! \n";
   print "+-------------------------------------+ \n";

   print << `EOL`;
   sqlplus -S "/as sysdba" <<SQLEND
         set pagesize 0
         set heading off
         set feedback off
         set echo off

         alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS'
         ;

         select 'Today is : ' || sysdate || ' on Database -> ' || name
         from v\\\$database
         ;
SQLEND
EOL
}

########
# MAIN #
########

test_01;

exit 0;

###########
# THE END #
###########

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About