Re: array rotate question

2004-09-22 Thread Ing. Branislav Gerzo
Jenda Krynicky [JK], on Wednesday, September 22, 2004 at 00:02 (+0200) made these points: $values = 10;#how much values in result JK many (taky si to furt pletu) :) thanks for correcting me. JK Assuming $values does not get bigger than the number of items in the JK list and $start is

array rotate question

2004-09-21 Thread Ing. Branislav Gerzo
Hello! I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result how to get output: @result = ( 5, 6, 7, 8, 9, 11, 12, 13, 14, 15 ); #10 values (I don't want

Re: array rotate question

2004-09-21 Thread JupiterHost.Net
Ing. Branislav Gerzo wrote: Hello! Hello, I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result how about for starters: my @list = qw(a b c d e f g h i j k l

Re: array rotate question

2004-09-21 Thread Jenda Krynicky
From: Ing. Branislav Gerzo [EMAIL PROTECTED] I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result many (taky si to furt pletu) how to get output:

Re: array rotate question

2004-09-21 Thread Gunnar Hjalmarsson
Ing. Branislav Gerzo wrote: I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result how to get output: @result = ( 5, 6, 7, 8, 9, 11, 12, 13, 14, 15 ); #10 values

Re: array rotate question

2004-09-21 Thread JupiterHost.Net
how about for starters: my @list = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z); my $result= getsection([EMAIL PROTECTED],20,10); for( @{ $result }) { print -$_-\n; } sub getsection { my @newa = (); my ($aref,$strt,$amnt) = @_; return undef if ref($aref) ne 'ARRAY' || $strt !~

Re: array rotate question

2004-09-21 Thread Gunnar Hjalmarsson
JupiterHost.Net wrote: Doh! Of course there was a shorter sexxier way! Jenda and Gunnar, you always rock! ;p Maybe Jenda, not me. Actually, both you and I misunderstood the OP. $start is not the beginning of a slice, it's the middle... -- Gunnar Hjalmarsson Email:

Re: array rotate question

2004-09-21 Thread John W. Krahn
Ing. Branislav Gerzo wrote: Hello! Hello, I am thinking about making clear and short script to rotate array, let's say: input: @list = (1 .. 20); $start = 10; #starting position $values = 10;#how much values in result how to get output: @result = ( 5, 6, 7, 8, 9, 11, 12, 13, 14, 15