http://www.perlmonks.org?node_id=1018273


in reply to How do you open a PDF file from a perl script in Windows?

Wow, that was fast. Thanks. All good questions. OK, here's what I found when I looked at how I created $outfile:
$0 =~ /(.*)\.pl/; my $outname = "$1.pdf";
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:
system $outname;
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.