--- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote:
> >
> > Try splice here:
> >
> > my $third = int(scalar @allfiles / 3);
> > my @set = ( [ splice @allfiles, 0, $third ], # first third
> > [ splice @allfiles, 0, $third ], # second third
> > [ @allfiles ], # the rest.
> > );
> >
> umm sure, just go about 5million feet above my conprehension right
> now ;)
lol -- check perldoc -f splice:
========================================================
splice ARRAY,OFFSET,LENGTH,LIST
splice ARRAY,OFFSET,LENGTH
splice ARRAY,OFFSET
splice ARRAY
Removes the elements designated by OFFSET and LENGTH from an array,
and replaces them with the elements of LIST, if any. In list
context, returns the elements removed from the array. In scalar
context, returns the last element removed, or undef if no elements
are removed. The array grows or shrinks as necessary. If OFFSET is
negative then it starts that far from the end of the array. If
LENGTH is omitted, removes everything from OFFSET onward.
If LENGTH is negative, leaves that many elements off the end
of the array. If both OFFSET and LENGTH are omitted, removes
everything.
The following equivalences hold (assuming $[ == 0):
push(@a,$x,$y) splice(@a,@a,0,$x,$y)
pop(@a) splice(@a,-1)
shift(@a) splice(@a,0,1)
unshift(@a,$x,$y) splice(@a,0,0,$x,$y)
$a[$x] = $y splice(@a,$x,1,$y)
Example, assuming array lengths are passed before arrays:
sub aeq { # compare two list values
my(@a) = splice(@_,0,shift);
my(@b) = splice(@_,0,shift);
return 0 unless @a == @b; # same len?
while (@a) {
return 0 if pop(@a) ne pop(@b);
}
return 1;
}
if (&aeq($len,@foo[1..$len],0+@bar,@bar)) { ... }
===========================================================
> > What's the value of $_ ???
> should be the passed in # from the for 1..2
> so I can say hey, lets parse array$_ or array$_ which would
> inturn be array1, array2......
I didn't see where it was being set.
Am I being dense again? :o/
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/