in reply to Re: how to force scalar context (without scalar())?
in thread how to force scalar context (without scalar())?
but sometimes these functions return a list even if I'm only interested in the scalar value. so I write:function( aa => otherfunction(), bb => anotherone() );
orfunction( aa => otherfunction(), bb => scalar( anotherone() ) );
but scalar() is a bit ugly and || something may change my return value. So I end up in using scalar orfunction( aa => otherfunction(), bb => anotherone() || '' );
I just search for a nicer look for a scalar like function. Using a sub ss ($) { $_[0] } is not a real option for me. But perhaps something other can provide the same functionality.my $another = anotherone(); <code> function( aa => otherfunction(), bb => $anotherone );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to force scalar context (without scalar())?
by Aristotle (Chancellor) on Sep 19, 2004 at 15:13 UTC | |
by borisz (Canon) on Sep 19, 2004 at 15:21 UTC | |
by ihb (Deacon) on Sep 19, 2004 at 21:40 UTC | |
by borisz (Canon) on Sep 19, 2004 at 21:54 UTC |