To comply with use strict on lexical scope, I reckon I need to start off with a variable declaration, which *doesn't* include an assignment: my $word;No, you only need the my in there. Whether you assign something or not doesn't matter any. May I suggest though, that in your case it would be more readable to do it this way:
Update: DOH! Ack. I don't know where I left my brain while I was posting the initial version of this. japhy++my $word = $part eq 'n' ? new Noun(@blah) : $part eq 'v' ? new Verb(@blah) : new Adjective(@blah); print $word->get_english();
Makeshifts last the longest.
In reply to Re: Good practice: Variable declaration
by Aristotle
in thread Good practice: Variable declaration
by Basilides
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |