#!/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 ";