in reply to Re: Everybody loves not using File::Find
in thread Everybody loves not using File::Find

To append the '/' when required with a regex :-
$dir=~s#(?<!/)$#/#;
Also I would suggest :-
next if ($path =~ /^\.\.?$/);
So that '.filename' file/directories are not ignored if you want to map these too.

Hope it helps
UnderMine

Replies are listed 'Best First'.
Re: Re: Re: Everybody loves not using File::Find
by submersible_toaster (Chaplain) on Nov 28, 2002 at 00:08 UTC

    Argh! non skinny substitution delimiters :). Lemme see if I understand though.

    s#(?<!/)$#/#;

    means... if the character / is NOT occuring as the last char in the string, substitute a / for the match, BUT since this is a zero width match ?< then presumably "/" replaces "" at the end of the string?.

    Not being a regex guru, and knowing that (at least for me), you're only as good as your best reference!! , I used the Perl In a Nutshell regex reference to unwrap this. However, the only mention of ! , is as the !~ operator, or in situations like (?<!=...) or (?!...) , being hesitant to use code before I understand it, am I even close?

    evil groan I don't want to map .anything (should have been clearer in the 1st post) , I like the .invisibility - and shall not shirk it!