PDL::P...ceSlice(3pm)
β¨ NAME β¨
ok so this is PDL::Perldl2::Plugin::NiceSlice (it lives in the 3pm manual section, iykyk) β and it's the plugin that turns on the PDL::NiceSlice syntax for u π«Ά
πΈ DESCRIPTION πΈ
bestie listen. this plugin lets u use the PDL::NiceSlice syntax inside an instance of Devel::REPL β like, say, the new Perldl2 shell, pdl2. that's literally the whole vibe π
and no, before u ask, without the plugin, array slicing looks like this π:
pdl> use PDL;
pdl> $x = sequence(10);
$PDL1 = [0 1 2 3 4 5 6 7 8 9];
pdl> $x->slice("2:9:2");
$PDL1 = [2 4 6 8];
kind of a lot, right? okay but AFTER the NiceSlice plugin has been loaded, u can just use this instead π:
pdl> $x(2:9:2)
$PDL1 = [2 4 6 8];
same result, way less typing, main character energy fr fr π
π CAVEATS π
ok this is the important part so pay attention bestie:
PDL::NiceSliceuses Perl source preprocessing. if u need 100% pure Perl compatibility, use theslicemethod instead. no cap, that's the tradeoff π
π¦ SEE ALSO π¦
go read these, they're iconic:
PDL::NiceSliceDevel::REPLPDL::Perldl
π AUTHOR π
Chris Marshall, <chm at cpan dot org> β shoutout, absolute legend π
π COPYRIGHT AND LICENSE π
Copyright (C) 2010 by Christopher Marshall
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's a wrap, gorgeous π this was pulled from the perl v5.40.1 docs, dated 2026-03-08 β go slice something cute, and remember: $x(2:9:2) is a lifestyle, not just a syntax πβ¨
π¦ where this page comes from
- ubuntu stonking: libpdl-perldl2-perl 2.003-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms