in reply to Confessions of a back-alley map abuser
sub{$sBegin}->() can be written @{ [ $sBegin ] }.
The one case were I frequently find myself “abusing” map in this fashion is to qr// a string built with function calls, usually a join with a bar:
my( $rx ) = map qr/($_)/, join '|', @alternative;
The other way to express this in condensed form is
my( $rx ) = do { local $" = '|'; qr/(@alternative)/ };
I'm not sure why I prefer the former (they're both kind of kludgy), but I do. :-)
Makeshifts last the longest.
|
|---|