Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re (tilly) 1: Unique-Character Substring

by salvadors (Pilgrim)
on Jan 20, 2001 at 19:40 UTC ( [id://53216]=note: print w/replies, xml ) Need Help??


in reply to Re (tilly) 1: Unique-Character Substring
in thread Unique-Character Substring

This doesn't do the same as the original. When fed "The quick brown fox jumps over the lazy dog" it returns "quick brown quick brown quick brown quick brown" rather than the "quick brown" of the original.

I also found it strange that you return @unique under one condition, and $str under another...

And I assume you meant the third argument to split rather than shift?

Tony

  • Comment on Re: Re (tilly) 1: Unique-Character Substring

Replies are listed 'Best First'.
Re (tilly) 3: Unique-Character Substring
by tilly (Archbishop) on Jan 20, 2001 at 20:24 UTC
    Oops, on both counts. I meant split, not shift.

    As for the different returns, in one case I verified that it was a unique string and so return the original, in the other I verified it was not and returned the substrings in it. However I don't keep context about locations in the original string, so I cannot tell whether a duplicate is because I found the same string through two paths. In your example through cutting on 'h' then 'e' I get to ' quick brown fox jumped ov' no matter which way I split on 'h' first.

    That is fixable, but not easily.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://53216]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-25 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found