http://www.perlmonks.org?node_id=1011313


in reply to Re: Need to change directory string.
in thread Need to change directory string.

Well, this produces .../demothumbs/..., but the OP states that he wants .../demo/thumbs/.... So a small amendment is needed:

2:29 >perl -wE "$d = 'test/home/players/demo//thumbs/super.jpg'; $d = +~ s[/{2,}][/]g; say $d;" test/home/players/demo/thumbs/super.jpg 2:34 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,