Assume I have to find the first unique character in a string

$string = "abtable";

# t is the first unique string

I tried using a negative backtrace lookup to get the answer in a
single regex ... But something is missing.

/(.).(?!\1)/ && print $1;

it seems fine ... But doesn't work

--
Sent from my mobile device

Thanks
Ram

Hello Ram

You were almost there.

$string =~ /(.)(?!.*\1)/;

Chris

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to