in reply to Re: Contents of directory without extensions
in thread Contents of directory without extensions

  • Why not use File::Find?
  • English is bad especially if not invoked as: use English qw( -no_match_vars );
  • You provide no argument to basename and thus do not remove extensions
  • use File::Basename; use File::Find; use vars '@listOfFiles'; find(sub{ return if -d $File::Find::name; #Remove last extension only... remove '?' to be greedy push @listOfFiles, (fileparse($File::Find::name, qr(\..+?)))[ +0]; }, '/path/of/least/resistance');

    --
    perl -p -e "s/(?:\w);([st])/'\$1/mg"

    Replies are listed 'Best First'.
    Re: Re: Answer: Contents of directory without extensions
    by data64 (Chaplain) on Nov 25, 2001 at 09:25 UTC
      You are right, I need to use fileparse instead of basename.
      What's with the -no_match_vars for use English;. I don't see that in the docs.
        That argument was added in 5.6.0 I believe, it prevents the globbing of the the evil saw ampersand and friends. (Since any program which uses these will take a great hit in the regular expression engine.)

        --
        perl -p -e "s/(?:\w);([st])/'\$1/mg"