in reply to Can i make this more efficient with a special variable?

There's nothing inefficient in there. You could remove the useless || undef, since the value is already false and you check for true/false not defined/undefined.
sub get_name { my $name = dblookup() || undef; $name; }
becomes
sub get_name { my $name = dblookup(); $name; }
becomes
sub get_name { dblookup(); }
becomes
*get_name = \&dblookup;
As for the if, you could do
if ( my $name = get_name() )

Replies are listed 'Best First'.
Re^2: Can i make this more efficient with a special variable?
by nmerriweather (Friar) on Jan 10, 2006 at 21:24 UTC
    thanks for your suggestions. i'm going to use them.