```{index} single: optimization; re function ``` ```{index} single: re::optimization; Perl function ``` # optimization Return a hashref of the optimiser's compile-time findings for a compiled pattern. Intended for writing tests that pin optimiser behaviour, not for application logic. The set of keys and the meaning of their values are not a stable API — they change as the optimiser changes, even between minor perl releases. ## Synopsis ```perl use re 'optimization'; my $info = optimization(qr/^\d+foo/); print $info->{anchored}; # 'foo' print $info->{'anchor SBOL'}; # 1 print $info->{minlen}; # minimum match length ``` ## What you get back A hashref, or `undef` if the argument is not a compiled pattern or its engine is unknown. Keys include `minlen`, `minlenret`, `gofs`, `anchored`, `anchored utf8`, `anchored min offset`, `anchored max offset`, `anchored end shift`, `floating`, `floating utf8`, `floating min offset`, `floating max offset`, `floating end shift`, `checking` (`"anchored"`, `"floating"`, or `"none"`), the booleans `noscan`, `isall`, `anchor SBOL`, `anchor MBOL`, `anchor GPOS`, `skip`, `implicit`, and `stclass`. ## Edge cases - Argument is not a `qr//` — returns `undef`. - Pattern has no extracted substrings — the substring-related keys are `undef` or `0` and `checking` is `"none"`. ## Differences from upstream - `stclass` is always `undef`. Upstream returns a textual rendering of the start class produced by `my_regprop`, which is compiled only with `PERL_EXT_RE_DEBUG` and is not available in this build.