in reply to Re: Trying to make the code more clear and clean
in thread Trying to make the code more clear and clean

I'll make them constans, left them as strings so it will be more readable for the readers of the thread.
  • Comment on Re^2: Trying to make the code more clear and clean

Replies are listed 'Best First'.
Re^3: Trying to make the code more clear and clean
by hippo (Archbishop) on Jul 29, 2019 at 14:34 UTC

    Personally I find that

    open(my $fh, '<', "$file_path") or return 0;

    is much less readable than

    open(my $fh, '<', $file_path) or return 0;

    With the former one is forced to ponder why the author has enclosed nothing more than a single scalar in double-quotes. Perhaps $file_path isn't really a scalar but is instead some path object requiring stringification. So then we have to go looking for the declaration of $file_path and assignments to it, etc. ... only to find that it's a just a plain string after all and the double-quotes are superfluous.

    Editing is an art for sure but cutting for clarity is one of the easiest tasks.

Re^3: Trying to make the code more clear and clean
by 1nickt (Canon) on Jul 29, 2019 at 14:32 UTC

    Nothing to do with constants. They are always strings, just quoted or not. You don't need to quote them when in use as hash key names.


    The way forward always starts with a minimal test.