#!/usr/bin/perl
#
# eg5: 4th coderef example: anonymous code refs
#

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

fun apply( $coderef, @args )
{
	return $coderef->( @args );
}

my $scalar = apply( fun ($x) { return $x * 2 }, 10 );
print "scalar: $scalar\n";

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