#! /usr/bin/perl use warnings ; use strict; open(FH,"infile") or die "File cant be opened\n"; while () { if (m/\d-(\d)"$/) { print "$1\n"; } }