#! /u/ss/bin/perl -w use Net::FTP; $ntsrv="ntsrv"; @number=qw(143 148 171 177 180 184 186 191 207 225 226 229 471 530 593 + 661 663 669 672 673 674 675 676 677 673 674 675 676 677 678 679 679A 681 685 687 691 700 702 703 7 +06 707 709 711 715 717 731 732 734 737 738 741 743 749 751 755 761 762 768 769 773 777 779 780 78 +1 788 821 824 828 875 886); $count=0; $in=" "; while ($count <= $#number) { $in=$ntsrv.$number[$count]; print "$in \n"; $ftp=Net::FTP->new("$in") or warn "Can't open $in: $!" ; $ftp->login("sfouser",'password') or warn "Can't login: $!"; if (!defined $ftp->ls){ print "Directory is empty \n"; } else { print $ftp->ls; print "\n"; } $ftp->put("test.txt") or warn "Can't transfer file: $!"; print $ftp->ls; print "\n"; $ftp->delete("test.txt") or warn "Can't delete file: $!"; if (!defined $ftp->ls){ print "Directory is empty \n"; } else { print $ftp->ls; print "\n"; } $ftp->quit() or warn "Can't quit from $in: $!"; print "finished\n \n"; $count++; }
In reply to Problems with Loop by lanier
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |