in reply to regex problem

regex doesn't work that way.

#!/usr/bin/perl # http://perlmonks.org/?node_id=1210321 use strict; use warnings; while(<DATA>) { my ($first, $rest) = /^(\w+)\s+([-\d]+)/; print "$first $_\n" for $rest =~ /\d+/g; } __DATA__ abcd 723-724 abcde 552-554-553 abcdef 756