#!/usr/bin/perl use strict; my @record = ( "662-5555", "+1 102 892-1314" ); for (@record) { print if /(^\d{3}-\d{4}$)/; }