gaochong wrote:
#!/usr/bin/perl -w
#Auther:gaochong
use strict;
my @list = (3 .. 9);
my @FA=("FA00000001".."FA00002000");
sub mk_fa {
my ($f) = @_;
foreach my $p (@list) {
mkdir "/data$p/NRU/$f",0755 or warn "mkdir /data$p/NRU/$f
err:$!";
symlink "/data$p/NRU/$f","/usr/local/Titan/NRU/$f" or warn
"symlink /data$p/NRU/$f err:$!";
shift @list;
You should *never* modify an array that you are iterating over in a
foreach loop. What exactly are you attempting to do here?
last;
}
}
foreach my $fa (@FA) {
if (@list > 0 ) {
&mk_fa($fa);
} else {
@list = (3 .. 9);
&mk_fa($fa);
}
Or simply:
@list = 3 .. 9 unless @list;
mk_fa( $fa );
}
John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/