#!/usr/bin/perl
#
# eg5a: map-style apply coderef example: anonymous code refs
#

use strict;
use warnings;
use Function::Parameters qw(:strict);

fun apply( $coderef, @args ) :(&@)
{
	local $_ = $args[0];
	return $coderef->( @args );
}

my $scalar = apply { $_ * 2 } 10;
print "scalar: $scalar\n";

my @array = apply { map { $_ * 2 } @_ } 1, 2, 3;
my $str = join(',',@array);
print "array: $str\n";
