use Modern::Perl; say map {(split)[1]} ; __DATA__ IF-abc/12 [Se/0/0] [Second data][third] IF-abc/1 [Gi/0/0] [Second data ]