What tells you that a line corresponds to a directory? The fact that it has a slash on the end of it? Here's a regular expression that will match such entries:
$line =~m#/$#;
But if you have such a marker of directories already, I'm not sure why you'd need to do what you're doing. If the existence and absence of a trailing slash isn't a reliable indicator of what's a directory (or even if you can't *assume* they are), then you'll have to go to the filesystem and use the -d filetest (see this node for more info on filetest operators).
HTH
In reply to Re: Complex string parsing
by arturo
in thread Complex string parsing
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |