program: open ($input, "<", "/root/tables"); while (<$input>) { table\s+([^{]+)\s+\{; print $1; } close ($input); sample from /root/tables/ create table dg_set( dg_seq integer not null, wc_seq integer not null, dg_name varchar(20) not null, comment varchar(50) not null ) program output: nothing