http://www.perlmonks.org?node_id=598530

neversaint has asked for the wisdom of the Perl Monks concerning the following question:

Dear Masters,
How can we split this string:
my $str = "ABC[GHI]XYZ"; # Note that in actual situation string may contain several # such bracketed alphabets.
into such array:
my @array = ("A", "B", "C", "GHI", "X", "Y", "Z");
meaning every characters in the bracket - [GHI] are treated as single entity in an array. I tried this:
perl -MData::Dumper -e ' $str ="ABC[GHI]XYZ"; @arr= split(/[\[\]]/,$str); print Dumper \@arr;'
but doesn't do the job.

---
neversaint and everlastingly indebted.......