Data::Dumper can't produce the output you desire. Behold:
Bareword found where operator expected at -e line 3, near "] String0" (Missing operator before String0?) Bareword found where operator expected at -e line 4, near "] String1" (Missing operator before String1?) Bareword found where operator expected at -e line 5, near "] String2" (Missing operator before String2?) Bareword found where operator expected at -e line 6, near "] String3" (Missing operator before String3?) Bareword found where operator expected at -e line 7, near "] String4" (Missing operator before String4?) Bareword found where operator expected at -e line 8, near "] String5" (Missing operator before String5?) Bareword found where operator expected at -e line 9, near "] String6" (Missing operator before String6?) Bareword found where operator expected at -e line 10, near "] String7" (Missing operator before String7?) syntax error at -e line 3, near "] String0" Execution of -e aborted due to compilation errors.

To get all the matches from the m// operator, you need list context (which you already have), but also the /g option:

my @matches = $initialStr =~ /\d+:\d+:\d+/g;

Or, to get closer to your desired output:

my @matches = $initialStr =~ /\[ .*? \] \s* ( \[ .*? \] .* )/gx;
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

In reply to Re: regex remove blank/whitespace until first occurrence of specific character "[" by choroba
in thread regex remove blank/whitespace until first occurrence of specific character "[" by thanos1983

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.