in reply to Re^4: how to force scalar context (without scalar())?
in thread how to force scalar context (without scalar())?
I really really wonder how you can think that
can be prettier thanfunc( aa => (my $aa = foo()), bb => (my $bb = bar()), );
One can argue code aesthetics all day, but your assignment can be a real pain in the long run and all it does is to fool the maintenance programmer into thinking that you especially want those values later. If you do this, although please don't, at least use a do block to handle the scoping issue (and make the maintenance programmer scratch his head a little less).func( aa => scalar foo(), bb => scalar bar(), );
func( aa => do { my $t = foo() }, bb => do { my $t = bar() }, );
ihb
Read argumentation in its context!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: how to force scalar context (without scalar())?
by borisz (Canon) on Sep 19, 2004 at 21:54 UTC |