Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How do you open a PDF file from a perl script in Windows?

by davido (Archbishop)
on Feb 12, 2013 at 16:00 UTC ( #1018400=note: print w/replies, xml ) Need Help??


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

I'm glad you got it working, but this line haunts me:

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.

What that tells me is that you aren't using strict, and that you are now creating variables inside of subroutines that you are accessing outside of the subroutines. A better approach would be to let your subroutine return a value that the calling code uses to initialize $outname


Dave

Replies are listed 'Best First'.
Re^3: How do you open a PDF file from a perl script in Windows?
by hmj6jmh (Initiate) on Feb 12, 2013 at 17:55 UTC
    Yes, of course, if I had used strict and warnings, this would have been avoided. I know I am following Perl Worst Practices. I will reform my undisciplined coding ways. Thanks, oh brother sufferer, for the admonition. ;) Meanwhile, why is exec behaving so?

      exec requires an executable to run, not a regular file.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018400]
help
Chatterbox?
[Your Mother]: My cat used to climb into the freezer when I opened it. Once I closed it and left him for 5 minutes hoping to disuade the habit. When I opened it expecting a cat eager to never return he just stared at me. Had to pull him out.
[Your Mother]: oiskuu, I think we should just be friends.
[marto]: the 'cool' place to hang out
[Your Mother]: ♫ Caffeine, caffeine, caffeine, caffeine. There will be answer, caffeine. ♫ ♬
[oiskuu]: Ahh, old cats with rheuma. I think (s)he was saying, "dude, NOT cold enough."

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2017-12-18 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (489 votes). Check out past polls.

    Notices?