this is my script to test whether or not I can ftp for the specified user for each host. But in only does the first host and never continues and I can't figure out what is wrong. I had the list of hosts in a file then I did an array as shown below and still nothing. PS. Thanks to the users who told me about Net::FTP.
#! /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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.