Does anyone know of a quick way of performing this: $testVar =~ s#/mail/.*$##g The only way I can think of doing it, is: mailPos = testVar.find( "mail" ) remainder = testVar[ :mailPos ] Any ideas would be appreciated. I'm iterating over a lot of entries, and running these lines for each entry. J