in reply to Grabbing slices
#! perl -slw use strict; my @array = qw[ x x y z z z ]; my @idxs = 0; $array[$_-1] ne $array[$_] and push @idxs, $_-1, $_ for 1 .. $#array; push @idxs, $#array; print "@idxs";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Grabbing slices
by jgallagher (Pilgrim) on May 03, 2003 at 19:37 UTC |