in reply to looking for a good idiom: return this if this is true

Probably not the "best", but I have one that make somewhat clever use of its placement in a subroutine to work in one line without creating a lexical. I'll put here the whole test program.
#!/usr/bin/perl -w use strict; my $foo = shift; sub one { return shift; } sub two { push @_, one( $foo ) and $_[0] ? return pop : pop; return "No arg"; } print two() . "\n";;
Maybe useful if you're looking for some obfuscation. It works with unshift/shift as well, of course.


Christopher E. Stith