in reply to Reg Exp help

Try saying out loud what you want to match: I want everything from the beginning of the line to the last backslash,

^.*\\

then possibly some more stuff

.*

and then the end of the line.

$

So, seems like it oughta be:

if ( $line =~ m/^(.*)\\.*$/ ) { ... }

As long as the directory-only lines always end with a backslash. Does that one work for you?

Replies are listed 'Best First'.
Re^2: Reg Exp help
by Anonymous Monk on Jun 04, 2008 at 18:53 UTC

    Whoops. Read your question wrong. The above looks for all directory names.