http://qs321.pair.com?node_id=287867


in reply to Constructive criticism of a dictionary / text comparison script

Initializing variables to an empty string is generally no advantage. Why not collapse those declarations into one line?

my ( $help, $man, $version, $token_debug, $glossary_output, $dictionar +y_output ); # or my ( $help, $man, $version, $token_debug, $glossary_output, $dictionar +y_output ) = ( '', '', '', '', '', '' );

GetOptions will also take a reference to a hash as its first argument, instead of all the variables. Much more concise and you don't have to worry three pages down what that variable was called.

--
TTTATCGGTCGTTATATAGATGTTTGCA

  • Comment on Re: Constructive criticism of a dictionary / text comparison script
  • Download Code

Replies are listed 'Best First'.
Re: Re: Constructive criticism of a dictionary / text comparison script
by allolex (Curate) on Aug 30, 2003 at 05:58 UTC

    You put your finger right on a major problem: I didn't actually go through and fix things that were a result of adding features to the script over a few days. Your version is a lot more legible (and looks cooler) than mine. I think I'll take you last bit of advice and stick everything in a hash.

    --
    Allolex

Re: Re: Constructive criticism of a dictionary / text comparison script
by PodMaster (Abbot) on Oct 13, 2003 at 10:57 UTC
    If you're gonna initialize all those vars to the same value, you might as well do it using x, as in
    my( $help, $man, $version, $token_debug, $glossary_output, $dictionary_output ) = ('') x 6;

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.