Re: Help on using << on *nix and Windows

[email protected] (Fi Dot)
Newsgroups perl.dbi.users,perl.beginners
Message-ID <[email protected]>
What happens if you try quoting with " " the "<<SQLEND" part?

Also, generally, interfacing with anything via external command line tool
rather than some API is less reliable and will give you all sorts of
problems.

Fi.




On Mon, Apr 19, 2010 at 2:21 AM, newbie01 perl <[email protected]>wrote:

> 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 #
> ###########
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.