in reply to Re: Question: Redirection of stdout to scalar variable
in thread Question: Redirection of stdout to scalar variable

Thank you Ikegami!

Since I am using Active Perl (Win32), IPC::Run did not show up in my package manager. I managed to use IPC::Run3 for the same. Thanks so much for the help. By the way the reason for all this is that dbms_output.put_line adds an extra LF at the end. I needed to strip it out. So the final code looks like this:

use strict; use warnings; use IPC::Run3; my @cmd = qw( sqlplus.exe -s scott/tiger@butthead ); my $in = <<'__END_OF_SQL__'; set echo off set lines 1000 set trims on set serverout on size 999999 set feed off exec dbms_output.put_line('Hello There'); exit; __END_OF_SQL__ run3 \@cmd, \$in, \my $out; print $out;
Thanks again everybody!

Ash

Replies are listed 'Best First'.
Re^3: Question: Redirection of stdout to scalar variable
by syphilis (Archbishop) on Mar 21, 2009 at 02:24 UTC
    IPC::Run did not show up in my package manager

    ppm install http://www.bribes.org/perl/ppm/IPC-Run.ppd

    Cheers,
    Rob