Arms, Mike wrote: > Suchindra Sandhu [EMAIL PROTECTED] wrote: > >>Suppose I have a string like >>$sequence = [sas]; >>How can I get rid of the leading and trailing brackets and just have >>$sequence = sas; >> >>One way I thought of was : >>chop($sequence); >>reverse($sequence); >>chop($sequence); >>reverse($sequence); >> >>This doesnt seem very clever. Can someone please help ? > > > > my $string = '$sequence = [sas]'; > $string =~ s/\[(.*?)\]/$1/; > print "string='$string'\n";
Another way: my $string = '$sequence = [sas]'; $string =~ tr/[]//d; print "string='$string'\n"; -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
