Re: splicing an array
- From: usenet@xxxxxxxxxxxxxxx
- Date: 25 Jan 2007 15:37:31 -0800
On Jan 25, 12:13 pm, "Xbiton" <jav...@xxxxxxxxxxxxxxxx> wrote:
main::scann_array() called too early to check prototype at
You should never use prototypes at all (it was a bad idea that most
programmers have abandoned - see Conway's "Perl Best Practices" for a
deeper explanation). That means your sub declaration should simply
say:
sub scann_array { # look, ma - no prototype! yaaa!
@a =<FILE>;
while(@a){
Never dump an entire file into an array unless you have a very good
reason for doing so (and you never will). Just do this:
while (<FILE>) {
and you should be using lexical filehandles anyway:
while ( <$file> ) {
Use of uninitialized value in concatenation (.) or string at
G:\addresse\scrape.pl line 37, <FILE> line 106.
If you process a 300 element file 7 lines at a time, you will have some
undefined lines (7 does not go evenly into 300).
and this error appear at the end of
the execution, many times, but also in the middle of the output
Probably because your STDOUT and STDERR are buffering differently. You
can fix that by doing this:
use IO::Handle;
*STDERR -> autoflush();
*STDOUT -> autoflush();
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
.
- References:
- splicing an array
- From: Xbiton
- splicing an array
- Prev by Date: Trying to re-arrange output of email with a list of items
- Next by Date: Re: Trying to re-arrange output of email with a list of items
- Previous by thread: splicing an array
- Next by thread: Trying to re-arrange output of email with a list of items
- Index(es):
Relevant Pages
|