still does not work $_ = "zzabtable"; /(.)(?!.*\1)/ && print "$1\n"; Output is z
On 8/24/11, Chris Charley <char...@pulsenet.com> wrote: >>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/ > > > -- Sent from my mobile device Thanks Ram <http://www.netcore.co.in/> n <http://pragatee.com> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/