# Top level my $choice = get_choice(); do_ip_manual() if $choice == 1; do_ip_fromfile() if $choice == 2; # Lower level sub do_ip_manual { my ($user, $pass) = get_auth(); ... } # Even lower level ... #### my $ret = system "`xcopy "C:\\Program Files\\UltraVNC\\*.*" "\\\\$ip\\C\$\\Program Files\\UltraVNC\\*.*" /r/i/c/h/k/e/Y"; die "xcopy failed" if $ret; $ret = 0; ... #### open(DAT,">>$resultOutput") || die("Cannot Open File"); print DAT "Bad username or password on the following machines:\n"; #### open DAT, ">>$filename" || die "foo"; #### open DAT, (">>$filename" || die "foo"); #### open(my $dat, ">>", $resultOutput") or die("Cannot Open File"); print $dat "Bad username or password on the following machines:\n";