Re: Reading X lines at a time

Georg Moritz <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
Hello Jose,

> @_=map{scalar(<>)}(1..$X)

inside a loop testing for eof is necessary:

while(!eof()&&(@_=map{scalar(<>)}(1..$X)){
    &foo; # gets @_
}

greets,
georg

-- 
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s,/,($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e,e && print}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.