in reply to Re: regexp for directory
in thread regexp for directory

thanx for your feedback! i still don't understand why it didn't work tho!

the useful parts

  • leave nothing inside while loop = no while loop!
  • use "die" with open/opendir
  • no need to quote "$dir" in open

    the ignored parts

  • i think my variable names are more meaningful than most, actually. They are distinctly different from one another and they are short. What would you call "%hash", "%associativearraywithcountforeachfile->key"? There is only one hash, and %hash is it. "$this" appears 3 times across 6 lines...it could be "$filecontent" i guess but i use "this" and "that" like tweedledee uses tweedledum. Kind of. "this" and "that"; it's cute ;P

  • whitespace, smightspace. what about the aesthetic value of having the last two lines the same length? Surely that contributes to readability, albeit "in a different sense".

    thanks again -- take care
  • Replies are listed 'Best First'.
    Re^3: regexp for directory
    by Fletch (Bishop) on Mar 17, 2008 at 21:13 UTC

      You can get meaningful without hyperextraneoverbositude. %matches_in_file or %count_for_file are extremely descriptive without requiring me to read the entire goram piece of code to figure out what exactly is going in %hash. Any decent editor will also let you autocomplete the name after the first one or two times anyhow so the overall length of the name isn't an excuse. And if you're going to be lazy-cutesy using the default subject variable $_ at least has the virtue of possibly shortening your code.

      Absolutely context free names like "this" and "that" just mean the maintenance programmer that follows n months hence is going to curse your crappy style, not praise your brevity and wit.

      Addendum: As to the lack of whitespace in the penultimate line, I'd just say it's people who write stuff like that in production code that give Perl the (somewhat deserved :) reputation for being executable line noise. Without reasonable whitespace you've got to scan back and forth to see where the breaks are (of course Mr. Maintenance programmer probably just learns to run anything you ever wrote through perltidy and tosses the originals away day one . . . ).

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

        Since no one came to my defense on this and this is a public forum, i've bowed to the public pressure regarding my variable names and use of whitespace. ie,

        No more thisandthat! No more thisandthat! No more thisandthat!