use Tk; my $my_MW=MainWindow->new(); $my_MW->title("Sample application"); $my_MW->geometry("350x180-500+500"); $my_MW->resizable( 'no', 'no' ); my $my_Button=$my_MW->Button(-text=>"Select CSV Input File",-command=> \&get_file); $my_Button->pack(-side=>"top",-expand=>1,-anchor=>"w",-padx => 20,-pady => 20); my $filepath=" .... "; my $my_Entry=$my_MW->Entry(-textvariable=> \$filepath); $my_Entry->pack(-side=>"top",-expand=>1,-anchor=>"w",-padx => 20,-pady => 0,-fill=>"x"); my $my_Button1=$my_MW->Button(-text=>"GENERATE",-width => 12,-command=>sub{\&gen_rslt()}); $my_Button1->pack(-side=>"left",-expand=>1,,-pady => 20); $my_Button1->configure(-state => 'disabled'); my $my_Button2=$my_MW->Button(-text=>"RESET",-width => 12,-command=>sub{\&clear_field()}); $my_Button2->pack(-side=>"left",-expand=>1,,-pady => 20); my $my_Button3=$my_MW->Button(-text=>"EXIT",-width => 12,-command=>sub{exit()}); $my_Button3->pack(-side=>"left",-expand=>1,,-pady => 20); MainLoop(); sub gen_rslt{ #Call the batch file and pass the file path as an argument! #batch file to open the file in notepad } sub clear_field{ $my_Entry->delete(0,'end'); $my_Entry->insert(0," .... "); $my_Button1->configure(-state => 'disabled'); } sub get_file { $my_Entry->delete(0,'end'); my @types = (["comma seperated files", [qw/.csv/]], ["All files", '*'], ); $filepath = $my_MW->getOpenFile(-filetypes => \@types) or return(); $my_Button1->configure(-state => 'normal'); }