#!/usr/bin/perl use strict; use warnings; use 5.018; # #1107536 my $program="D:\\GnuWin32\\bin\\ls.exe"; print "$program\n"; runit ($program); sub runit { system ("$program"); if ($? == -1) { print "failed to execute: $!\n"; } say "\n\t DEBUG: reached the end of sub runit at Ln23"; sleep 1; } say "\n Done with first sub, back in main. \n"; my $path = 'D:/GnuWin32/bin/'; my $pgm="ls.exe"; my $cmd ="$path" . "$pgm"; runit2 ($cmd); sub runit2 { say "\n\tEntering runit2\n"; sleep 3; my ($cmd_in_sub) = @_; say "\n\t DEBUG: $cmd_in_sub\n"; system ("$cmd_in_sub"); if ($?) { print "failed to execute: $!\n"; } } say "\n Done with second sub "; #### D:\>D:\_Perl_\PMonks\1107536NON-GUI.pl d:\_wo D:\GnuWin32\bin\ls.exe .. TestFiles Connexions tbos.css CPM-ZCPR ViennaProtocol.txt created_psp_files WinSHAetc DEBUG: reached the end of sub runit at Ln23 Done with first sub, back in main. Entering runit2 DEBUG: D:/GnuWin32/bin/ls.exe ... TestFiles Connexions tbos.css CPM-ZCPR ViennaProtocol.txt created_psp_files WinSHAetc.... Done with second sub D:\>