You could use glob with substr although it gives a warning.

johngg@shiraz ~/perl/Monks $ perl -Mstrict -Mwarnings -E ' my $str = q{0ae}; my $globStr = q/{/ . join( q{,}, 0 .. 9, q{a} .. q{f} ) . q/}/; for my $off ( 0 .. length( $str ) + 1 ) { my $new = $str; substr $new, $off, 0, $globStr; say for glob $new; }' 00ae 10ae 20ae 30ae 40ae 50ae 60ae 70ae 80ae 90ae a0ae b0ae c0ae d0ae e0ae f0ae 00ae 01ae 02ae 03ae 04ae 05ae 06ae 07ae 08ae 09ae 0aae 0bae 0cae 0dae 0eae 0fae 0a0e 0a1e 0a2e 0a3e 0a4e 0a5e 0a6e 0a7e 0a8e 0a9e 0aae 0abe 0ace 0ade 0aee 0afe 0ae0 0ae1 0ae2 0ae3 0ae4 0ae5 0ae6 0ae7 0ae8 0ae9 0aea 0aeb 0aec 0aed 0aee 0aef substr outside of string at -e line 7.

I hope this is useful.

Update: This gets rid of the warning.

johngg@shiraz ~/perl/Monks $ perl -Mstrict -Mwarnings -E ' my $str = q{0ae}; my $globStr = q/{/ . join( q{,}, 0 .. 9, q{a} .. q{f} ) . q/}/; for my $off ( 0 .. length $str ) { my $new = $str; substr $new, $off, 0, $globStr; say for glob $new; } $str .= $globStr; say for glob $str;' 00ae 10ae 20ae 30ae 40ae 50ae 60ae 70ae 80ae 90ae a0ae b0ae c0ae d0ae e0ae f0ae 00ae 01ae 02ae 03ae 04ae 05ae 06ae 07ae 08ae 09ae 0aae 0bae 0cae 0dae 0eae 0fae 0a0e 0a1e 0a2e 0a3e 0a4e 0a5e 0a6e 0a7e 0a8e 0a9e 0aae 0abe 0ace 0ade 0aee 0afe 0ae0 0ae1 0ae2 0ae3 0ae4 0ae5 0ae6 0ae7 0ae8 0ae9 0aea 0aeb 0aec 0aed 0aee 0aef 0ae0 0ae1 0ae2 0ae3 0ae4 0ae5 0ae6 0ae7 0ae8 0ae9 0aea 0aeb 0aec 0aed 0aee 0aef

Update 2: Shouldn't post late at night when brain already half asleep! The warning was because I was being an idiot, length( $str ) + 1 should be length $str of course :-/

johngg@shiraz ~/perl/Monks $ perl -Mstrict -Mwarnings -E ' my $str = q{0ae}; my $globStr = q/{/ . join( q{,}, 0 .. 9, q{a} .. q{f} ) . q/}/; for my $off ( 0 .. length $str ) { my $new = $str; substr $new, $off, 0, $globStr; say for glob $new; }' 00ae 10ae 20ae 30ae 40ae 50ae 60ae 70ae 80ae 90ae a0ae b0ae c0ae d0ae e0ae f0ae 00ae 01ae 02ae 03ae 04ae 05ae 06ae 07ae 08ae 09ae 0aae 0bae 0cae 0dae 0eae 0fae 0a0e 0a1e 0a2e 0a3e 0a4e 0a5e 0a6e 0a7e 0a8e 0a9e 0aae 0abe 0ace 0ade 0aee 0afe 0ae0 0ae1 0ae2 0ae3 0ae4 0ae5 0ae6 0ae7 0ae8 0ae9 0aea 0aeb 0aec 0aed 0aee 0aef

Cheers,

JohnGG


In reply to Re: Generate list of possibilities from incomplete input by johngg
in thread Generate list of possibilities from incomplete input by Pascal666

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.