21 lines
292 B
Perl
21 lines
292 B
Perl
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
|
|
my $productRef = sub
|
|
{
|
|
my $product = 1;
|
|
|
|
foreach ( @_ ) {
|
|
$product *= $_;
|
|
}
|
|
|
|
return $product;
|
|
};
|
|
|
|
my $printVal = &$productRef( 1, 2, 3, 4 );
|
|
print( join( ' * ', 1, 2, 3, 4 ), " = " );
|
|
print( "$printVal\n" );
|
|
|