in reply to Re: Re: my, my, my
in thread my, my, my
No, that wouldn't help. There has to be a way to discriminate declaration from use if you want to be able to tell a use of a mistyped variable apart from a declaration of a new one. I don't think three characters is a high price to pay for that service - especially considering you can, if the occasion lends itself to it, declare multiple variables with a single my.
Your code has room for clarification and shortening in other areas; I'd write it like this:
(The jury's still out on how to indent the dangling last "default" expression, btw. I'm not entirely satisfied with any of the options so far.)sub getDivisionList { (my ($agency_name, $nodes_only) = @_) or return; my $obj = __PACKAGE__->new($agency_name); my @node = $obj->{ts}->get_node_list('division'); return (!@node) ? () : $nodes_only ? ($o, @n) : map {($n->value('divname'), $n->value('siebel_id'))} @n; }
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: my, my, my
by BrowserUk (Patriarch) on Nov 16, 2002 at 10:22 UTC | |
by Aristotle (Chancellor) on Nov 16, 2002 at 14:50 UTC | |
by BrowserUk (Patriarch) on Nov 16, 2002 at 15:21 UTC |