in reply to Good practice: Variable declaration
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Good practice: Variable declaration
by japhy (Canon) on Jun 27, 2002 at 17:32 UTC |