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
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
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
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:
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
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 !~
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:
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