Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
XP is just a number

Comment on


Given a (long) string $s, and a test string $t.

Find for perl golf a subroutine to determine if the characters of $t are in $s, not necessarily consecutive but in order, returning true if so, false if not. For example, if $s = "abcdefghijklmnopqrstuvwxyz", then the sub should return true for $t = "for", but not $t = "perl".

For extra credit, have the sub return undef if the string isn't found, and the remainder of $s minus those characters of $t that were matched, with the remaining characters in the same order, if $t was in $s.


In reply to Golf: Embedded In Order by Masem

and:  <code> code here </code>

  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (6)
    As of 2014-03-16 22:41 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (336 votes), past polls