in reply to Using STDIN with IO::CaptureOutput
You're question is already answered but for your particular issue, check the parameter options for your 'sql' program. There might very well be an input_file option (typically '-i <filename>' or @filename).. or there might be a way to load the file interactively from within 'sql' : loadfile '<filename>'.
In Section
Seekers of Perl Wisdom