#!/usr/bin/perl -w use strict; while(){ /^(\w+)\s+(\w+)$/; print "<$1><$2>\n"; } __DATA__ abc def xyz 6-7 123 456 #### <123><456>