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


in reply to remove lines from file ending with / char

Please, give us more information: Is it possible for a directory to be mentioned once with no content, but later with a file, like this?
/foo/bar/ /foo/bar/baz
Or only the "empty" directories can be listed without files. If so, you can just use
grep { 0 != index reverse($_), '/' } @files
or
grep !m{/$}, @files
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ