palkia has asked for the wisdom of the Perl Monks concerning the following question:

hello
I just used perl to create a text file.
my question is: how do I use perl to open and close that file in it's original program (notepad) ?
I tried to use the exec commend but from some reason it won't do anything after (know why?).
so I tried the system commend but that one wont continue the program until I close the notepad.
ideas ?
thx

thank you very much ikegami.
your 2nd (only) suggestion worx perfectly.
can u explain the syntax please ?
what does the "start" does ? and can it be replaced by other commends ?
and what's the "" vs the "$url" and why if I only use one of them, it only opens the commend line instead of the file ?
thx again
  • Comment on How can I open a file in it's default program ?

Replies are listed 'Best First'.
Re: How can I open a file in it's default program ?
by ikegami (Patriarch) on Mar 21, 2011 at 23:22 UTC

    I think you can simply do

    system(qq{"$path_to_document"})

    If not, you can definitely do

    system(qq{start "" "$path_to_document"})

    Update: I answered about subject question, default program. The program used to originally create the file could very well be an entirely different. I didn't notice that the question in the body of the post was different.

Re: How can I open a file in it's default program ?
by BrowserUk (Patriarch) on Mar 21, 2011 at 23:27 UTC
    how do I use perl to open and close that file in it's original program (notepad) ?

    It depends upon whether the file type of the file in question is associated with the program in question?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.