splicing an array
- From: "Xbiton" <javier@xxxxxxxxxxxxxxxx>
- Date: 25 Jan 2007 12:13:47 -0800
Hi all,
I've an array of about 300 elements. I want to splice 7 elements at the
time, process this and then splece another 7 elemnts untill the end:
first ploblem if I use the scann_array function, perl say:
main::scann_array() called too early to check prototype at
G:\addresse\scrape.pl line 36.
and I don't know what that mean.
Ok I changed this an call splice in the while loop,
my ($name,$rub,$nl,$addr,$map,$tet,$capital) = splice(@a, 0,6);
but then perl says:
Use of uninitialized value in concatenation (.) or string at
G:\addresse\scrape.pl line 37, <FILE> line 106.
106 is the last line of the file, and this error appear at the end of
the execution, many times, but also in the middle of the output
Thanks.
Xbiton
----------------------------------
my @file = glob("*.eu");
foreach my $f (@file){
open(FILE, "$f");
my @a =();
@a =<FILE>;
my $count =@a;
while(@a){
my ($name,$rub,$nl,$addr,$map,$tet,$capital) =
scann_array(@a);
print "$name,$rub,$nl,$addr,$map,$tet,$capital";
}
}
sub scann_array(\@){
return splice(@{$_[0]},0,6);
}
.
- Follow-Ups:
- Re: splicing an array
- From: usenet
- Re: splicing an array
- Prev by Date: Re: MD5 (version 2.36) not match with boottrap parameters on perl 5.8 lib (version 2.16)
- Next by Date: Re: parsing XML
- Previous by thread: Calling functions from modules
- Next by thread: Re: splicing an array
- Index(es):
Relevant Pages
|