Re: how to accept array elments using loop



On Dec 28, 2007 7:42 PM, <lumadhu@xxxxxxxxx> wrote:
Hi all,
I am new user of this group. can you tell how can i accept
array elements using loop. for example
for($i=0;$i<5;$i++)
{
$a[$i]=<stdin>;
}


use strict;

my @arr;

while(<>) {
chomp;
push @arr,$_;
}
.



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: New style DO syntax?
    ... Joe Krahn wrote: ... I think that the DO-loop is the only "block construct" that does not contain the 'expression/attribute' part in parenthesis. ... Using parenthesis for delimiters should also allow for using array elements as do iterators. ... Capture the value of I at loop start and use that for ...
    (comp.lang.fortran)
  • 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: Word counting
    ... length so increment our word length to search for by 1. ... Loop through our array elements and hopefully we'll have the words ... This is an example input file ...
    (comp.lang.ada)