Re: Multiple File upload



vijay@xxxxxxxxxx <vijay@xxxxxxxxxx> wrote:

@files = 4;


That array has one element in it.


for(my $i=1;$i<=scalar(@$files);$i++){


Where have you defined $files?

You should always enable warnings and strict when developing Perl code:

use warnings;
use strict;

Assumming you meant @files instead of @$files, then the loop
will iterate 1 time, because that is what you told it to do.

If you want a loop that will iterate 4 times, then something
like this will do it:

foreach my $i ( 1 .. 4 )


--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
.



Relevant Pages

  • Re: File handle re-use woes using pipe within a loop
    ... >> I'd recommend using strict and lexical file handles, ... If something is lexically scoped within a loop then each time through ... This uses sybolic handle references. ...
    (comp.lang.perl.misc)
  • Re: future of lazy programming
    ... evaluation semantics will loop with strict evaluation. ... rather than strict vs lazy evaluation. ...
    (comp.lang.functional)
  • Re: reg exp
    ... So in my while loop I say if line not like ANS or ANR using operator!~ ... looked in my learning perl and programming perl books and did not find this ... which sums up the number read into $total. ... > use strict 'subs'; ...
    (perl.beginners)
  • Re: target practice -- lottery numbers
    ... when you generate a number and then loop through the list to ... undef values, to silence the warnings. ... If there are three values in the array, ... Here's you strict problem. ...
    (perl.beginners)
  • Re: read consecutive lines
    ... use strict; ... use warnings; ... Not clear to me what you want in this for loop: ... There is no array @l that could be accessed with $l. ...
    (perl.beginners)