# PDL::Slices
📦 stdpdl
## Synopsis
```none
use PDL;
my $a = sequence(10);
my $s = $a->slice("2:5");
my $i = $a->index(pdl [1, 3, 5]);
my $d = $a->dice([2, 4, 6]);
```
## Functions
### Other Functions
#### [`slice`](Slices/slice.md)
`$pdl->slice($spec)` – extract a rectangular slice of an ndarray.
#### `xchg`
`xchg($pdl, $dim1, $dim2)`
#### `mv`
`mv($pdl, $from, $to)`
#### `reorder`
`reorder($pdl, @dims)`
#### `reshape`
`reshape($pdl, @new_dims)`
#### `flat`
`flat($pdl)`
#### `diagonal`
`diagonal($pdl, $dim1, $dim2)`
#### `dice`
`dice($pdl, @index_lists)`
#### `dice_axis`
`dice_axis($pdl, $dim, $indices_pdl)`
#### `uniq`
`uniq($pdl)`
#### `uniqvec`
`uniqvec($pdl)`
#### `hclip`
`hclip($pdl, $max)`
#### `lclip`
`lclip($pdl, $min)`
#### `clump`
`clump($pdl, $n)`
#### `dummy`
`dummy($pdl, $dim, $size?)`
#### `lags`
`lags($pdl, $nthdim, $step, $nlags)`
#### `splitdim`
`splitdim($pdl, $dim, $size)`
#### `rotate`
`rotate($pdl, $shift)`
#### `mslice`
`mslice($pdl, @args)` — slice variant where each arg is a scalar (start, truncated to int) or [start, stop, inc?] arrayref. Mirrors `Core.pm:2545` `*PDL::mslice = \&PDL::slice` combined with the numeric-arg parsing in `PDL::NiceSlice`’s mslice translation.
#### `range`
`range($source, $index, $size?, $boundary?)` — extract elements (or rectangular sub-cubes with `$size`) at N-D coordinates given by `$index`.
#### `make_physdims`
`make_physdims($pdl)` — no-op stub. Upstream triggers deferred trans evaluation; our slices materialize eagerly, so nothing to do except return self.
#### `transpose_entry`
Public forwarder for `PDL::t` (MatrixOps alias).
#### `transpose`
`transpose($pdl)` — transpose a 2D matrix (swap dims 0 and 1). Same as `$pdl->xchg(0,1)`.
#### `rle`
`rle($pdl)` — run-length encoding. Returns (`$lengths`, `$values`) — two PDLs: run lengths and corresponding values. For 2D+ input, operates over the first dimension (broadcasting).
#### `rld`
`rld($lengths, $values)` — run-length decoding (inverse of rle). Returns a PDL reconstructed from run lengths and values.
#### `ins`
`ins($target, $source, @pos)` — insert `$source` into `$target` at position `@pos`. Copies source data into target starting at the given coordinates. Modifies `$target` in-place, returns `$target`.
#### `sec`
`sec($pdl, $x1, $x2, $y1, $y2, ...)` — extract a rectangular section. Deprecated upstream; equivalent to `$pdl`->`slice("$x1:$x2,$y1:$y2,...")`. Takes pairs of (start, end) indices for each dimension.