use strict; use warnings; while () { if (/(.*)\\$/) {print "$1\n"} } __DATA__ \windows\server\locales\en_US\help\whxdata\whftdata0.xml \windows\server\locales\en_US\help\whxdata\ \windows\server\locales\en_US\help\whxdata\whfwdata0.xml \windows\server\locales\en_US\help\whxdata\whfwdata1.xml \windows\server\locales\en_US\help\whxdata\whfwdata2.xml \windows\server\locales\en_US\help\whxdata2\ #### \windows\server\locales\en_US\help\whxdata \windows\server\locales\en_US\help\whxdata2