#!/usr/bin/env perl -l use strict; use warnings; while () { my @caught = /\{([^}]+)/g; next unless @caught; print for @caught; }