in reply to Saving state in cgi.pm question

This should be what you're intending:
if (open($fh, ">", $file)) { $query->save($fh); close($fh); } else { # Die? Complain? }
The documentation indicates that any filehandle is valid. Since passing older-style (pre-5.6?) filehandles is tricky, using the newer method is easier. That's $fh instead of FH