in reply to need a clearer understanding

Initializing hashes or arrays that way doesn’t buy anything. The scalar initialization to an empty string can actually matter if you want to avoid a certain kind of warning–

moo@cow[91]~>perl -we 'my $s; $s =~ /./' Use of uninitialized value $s in pattern match (m//) at -e line 1. moo@cow[92]~>perl -we 'my $s = ""; $s =~ /./' moo@cow[93]~>

I prefer no warnings "uninitialized"; for this general case but sometimes you really do want to know if the scalar has an assignment, even the empty string, or not.

Replies are listed 'Best First'.
Re^2: need a clearer understanding
by DanielM0412 (Acolyte) on Aug 09, 2011 at 19:06 UTC
    ill update the code

      Please don't update your post without leaving the original question and labeling the update. It makes the original answers seem non-sensical.