in reply to Here document and sqlplus

The simplest (fix) I can think of is to redirect the output of sqlplus to a file, and then read from that file afterwards.
open (SQLPLUS, "|sqlplus -s usernam/pass > result.txt" ) or die ""; print SQLPLUS <<SQL select * from tab where tnam like 'monks'; SQL close SQLPLUS; # read the results open RESULT, "<result.txt"; $result = do { local $/; <RESULT> }; close RESULT;