Wow, that was fast. Thanks. All good questions. OK, here's what I found when I looked at how I created $outfile:
in reply to How do you open a PDF file from a perl script in Windows?
This was in a subroutine so $outfile was local. I then tried to use it outside the subroutine so that was the problem. I removed the my and now the above call works. I can also invoke just the name and that works too:
$0 =~ /(.*)\.pl/;
my $outname = "$1.pdf";
I tried this with exec and I get:
There was an error opening this document. This file cannot be found. and then it opens when I 'OK' the dialog. What is the syntax for exec? I though it was the same.