in reply to looking for a good idiom: return this if this is true
Maybe useful if you're looking for some obfuscation. It works with unshift/shift as well, of course.#!/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";;
|
|---|