### comment on

 Need Help??
This is an attempt to save a thread in SoPW which I thought can be useful for others.

There are already incredible answers in the thread, so feel free to check in SoPW. Please don't misunderstand me. I honestly think this can be useful. I don't mean to boost my XP here, or in that thread which I posted.

One possible answers is given by good sgifford

```#!/usr/bin/perl -w
use strict;

my \$s1 ='CCCATCTGTCCTTATTTGCTG';  my @a1 = qw(ATCTG ATTTG);
my \$s2 ='ACCCATCTGTCCTTGGCCAT';   my @a2 = qw(CCATC);
my \$s3 ='CCACCAGCACCTGTC';        my @a3 = qw(CCACC CCAGC GCACC);
my \$s4 ='CCCAACACCTGCTGCCT';      my @a4 = qw(CCAAC ACACC);

put_bracket(\$s1,\@a1);
put_bracket(\$s2,\@a2);

put_bracket(\$s3,\@a3);
put_bracket(\$s4,\@a4);

sub put_bracket
{
my( \$str, \$ar ) = @_;

foreach my \$subs ( @\$ar  )
{
# Construct a regexp with [\[\]] between all the letters
my \$newsub = join '[\[\]]?', split //, \$subs;
\$str =~ s/(\$newsub)/[\$1]/g;
}

# Now de-nest the brackets in the string
my \$depth = 0;
my \$newstr = '';
foreach my \$c ( split //, \$str )
{
if ( \$c eq '[' ) {
\$newstr .= \$c
if \$depth++ == 0;
}
elsif ( \$c eq ']' ) {
\$newstr .= \$c
if --\$depth == 0;
}
else {
\$newstr .= \$c;
}
}

return \$newstr;
}
More can be found here. Don't vote my root posting but vote those remarkable answers you will find there.
Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Are you posting in the right place? Check out Where do I post X? to know for sure.
• Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
• Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
• Want more info? How to link or or How to display code and escape characters are good places to start.

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2022-01-26 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
In 2022, my preferred method to securely store passwords is:

Results (69 votes). Check out past polls.

Notices?