in reply to So what is an array slice anyway?
Behold!
my @p = (0..10); my @q = (1..9); if ( ( () = @p[0,1,2] ) == ( () = @q[3,6,1] ) ) { print "p slice == q slice\n" }
You can either assign your slice directly to an array and compare the scalar value of the arrays or you can use ( () = LIST ) and compare them directly.
Disclaimer: I also like Lisp, so I see some beauty in the parentheses bomb.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: So what is an array slice anyway?
by beable (Friar) on Aug 26, 2004 at 04:52 UTC | |
by Aristotle (Chancellor) on Aug 26, 2004 at 08:13 UTC | |
by beable (Friar) on Aug 26, 2004 at 07:20 UTC | |
by McMahon (Chaplain) on Aug 26, 2004 at 14:29 UTC |
In Section
Seekers of Perl Wisdom