if( my(@matches) = $_ =~ m/(\[.*?\])/g ) { print "$_\n" for @matches; }