use IPC::Open2; use POSIX ":sys_wait_h"; my @results = Sql( 'select ...' ); sub Sql { my $command = shift; my $options = ( shift() || '-qs' ) . ' -'; my $pid = open2 my $rh, my $wh, 'ac_bl ' . $options; write $wh $command; close $wh; my @results = <$rh>; chop @results; close $rh; waitpid $pid, 0; return @results; }