#!/usr/bin/perl $fn = "/home/t8.g"; open FP, "$fn" or die "Error in write:$!"; while () { my @caught = /\{([^}]+)/g; next unless @caught; say for @caught; print @caught, "\n"; }