in reply to Re^2: how to split a string at [ ?
in thread how to split a string at [ ?

Name "charnames::CARP_NOT" used only once: possible typo at /usr/lib/p +erl5/5.18.2/Carp.pm line 437. Name "Regexp::Common::delimited::CARP_NOT" used only once: possible ty +po at /usr/lib/perl5/5.18.2/Carp.pm line 437.

Those are warnings, not errors, and I can't seem to be able to reproduce them here (don't have 5.18.2 handy though). Are you perhaps using perl -w on the command line or on the shebang line? In that case, see What's wrong with -w and $^W and use warnings; instead.

The other issue with that code is that $string=~/(regex)/ won't return the match(es) unless you use it in list context, but my $temp = ... puts it in scalar context. To put the right-hand side into list context, use my ($temp) = $string =~ /(regex)/;.