FM has asked for the wisdom of the Perl Monks concerning the following question:
Dearest Monks,
I don't understand why the following piece of code does not work the way I expect it (it opens a command prompt window when I expect it to open notepad). My goal is to open a .txt file in its native application which I assume to be notepad. The file is created and closed before I attempt to run this piece of code.The following code opens Guide in its native application (adobe). In this case I don't worry about the path because I know that that file is in the same folder than the application code.sub logfile{ my $file = "$gGui{complogpath}/$gGui{complog}.txt"; my @args = ("start",$file); for (@args) { if (/ /) { $_ = qq{"$_"}; } }; system(@args) == 0 or warn "Couldn't launch '$file' : $!/$?/$^E"; }#logfile
sub help{ my $file = "Guide.pdf"; my @args = ("start",$file); for (@args) { if (/ /) { $_ = qq{"$_"}; } }; system(@args) == 0 or warn "Couldn't launch '$file' : $!/$?/$^E"; }#help
I would appreciate any thoughts you may have.
Thanks in advance for your time.
Claire
|
---|