I know I may be nit-picking, but in this case I think it is more readable, and makes more sense to use a foreach loop here.
#!/usr/bin/perl -w
use strict;
my $ntsrv="ntsrv";
my @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 6
+79A 681 685 687 691 700 702 703 706 707 709 711 715 717 731 732 734 7
+37 738 741 743 749 751 755 761 762 768 769 773 777 779 780 781 788 82
+1 824 828 875 886);
my $in=" ";
foreach $in (@number) {
$in=$ntsrv.$in;
print "$in \n";
--------------Insert ftp code here (not installed at my site...)----
print "finished\n \n";
}
The loop you had worked fine for me, so maybe it's not the loop that is not working, but your code is hanging when it is trying to connect to the first ftp server? Try debugging the code:
perl -d file.pl
"n" to execute the next line
It can do lots of useful stuff and is well worth learning. My O'Reilly "Programming Perl" has a good tutorial that I always refer to, I don't know off the top of my head of any online tutorials to the debugger.
Good luck!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.