PDL::P...ceSlice(3pm)

πŸ“¦ version 2.003, in ubuntu stonking

✨ 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::NiceSlice uses Perl source preprocessing. if u need 100% pure Perl compatibility, use the slice method instead. no cap, that's the tradeoff πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

go read these, they're iconic:

  • PDL::NiceSlice
  • Devel::REPL
  • PDL::Perldl

πŸ’– AUTHOR πŸ’–

Chris Marshall, <chm at cpan dot org> β€” shoutout, absolute legend 🌈


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