in reply to Use text string as stdin for system process

I suggest you try something like DBI to perform queries in perl. It's going to be a lot easier to maintain and operate.

But you can probably get this to work with pipes or something:

open my $out, "|sql>tmpfile" or die $!; print $out "select 'soemthing';\n"; print $out "exit;"; close $out; my $x = `cat tmpfile`;

To do the whole thing with pipes, look at IPC::Open3 or POE::Wheel or something.

-Paul

Replies are listed 'Best First'.
Re^2: Use text string as stdin for system process
by baldywilson (Initiate) on Jan 05, 2007 at 16:00 UTC
    Yeah, that's pretty much what I wanted to do. But for some stupid reason, that's no-one can clearly explain to me, I'm being told I can't access their database except through the command-line tool. Don't ask - I've already given up asking :)

    Open2 and Open3 appear to be coming up as good possibilities. I'll have to go and have a look. Thanks!

      Uhhh ... how are they going to know?

      -derby
        The b***ards are going to check the source.