while(<>){ print if m!(\d+)\D*to\D*(\d+)!i; print "$1\n"; print "$2\n"; }