in reply to phone number regex

First of all, you don't want to assign to @list in your loop, since that will get rid of anything put in it from a previous line of the file. push @list, morestuff instead.

It sounds like you might have more than one number per line, so you'd want to use the //g flag to get more than one match. Your regex should capture the whole numbers with | to alternate between the different patterns, and strip out the extra characters afterward. Then format it as xxx-xxxx or xxx-xxx-xxxx depending on how long it is.