简体   繁体   中英

Perl/Tk System Function Error?

I am making an "all-in-one calculator" (I guess). Here is my code (I know I do not have all subroutines defined, I'm still working on this as you can see):

use 5.12.4;
use warnings;
use Tk;

##### Create MainWindow #####
my $button_menu = new MainWindow;
#############################

##### MainWindow Buttons#####
my $calculator_button = $button_menu->Button(-text=>"Calculator",
                                         -width=>10,
                                         -relief=> 'raised',
                                         -command=>\&open_calculator)->pack();

my $formulas_button = $button_menu->Button(-text=>"Formulas",
                                   -width=>10,
                                   -relief=> 'raised',
                                   -command=>\&open_formulas)->pack();


sub open_calculator{
    system(qq{start "C:\\Windows\\system32\\calc.exe"});
}

MainLoop;

Why does the system function not open the Windows calculator?

Thanks!

尝试这个:

system(qq{start calc});
system('start C:\Windows\system32\calc.exe');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM