Re: splicing an array



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)

.



Relevant Pages

  • Re: sub declarations
    ... Can anybody tell me difference among all of the following sub declaration. ... sub xyz() # Please not round brackets, When I had this definition, ... Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl ...
    (perl.beginners)
  • Re: Exceptional Rails Developer
    ... prototypes using the cheapest contractors that money can buy. ... "I've been taught best practices". ...
    (comp.lang.ruby)