in reply to Regex with variables?

...and here's a non-regex solution:

while ( <DATA> ) { my $comp = (split /-/)[-1]; print $comp; } __DATA__ domainA-comp1 domainB-comp2 domainC-comp3

dave