if ($file =~ m/\[(.*?)\]/m ) { my $inside = $1; print "$inside\n"; } #### Something [ 'name', 'joe', 'bopeep' ]