You can do currying-like things in
Perl, too, using
closures. Here is an example.
sub foo
{
my $x = shift;
sub {
my $y = shift;
sub { my $z = shift; $x * $y + $z }
}
}
print foo(2)->(3)->(4), "\n";
When foo is called with the argument 2, it returns a function equivalent to
sub foo_1 { my $y = shift; sub { my $z = shift; 2 * $y + $z } }
When this function is called with the argument 3, it returns a function equivalent to
sub foo_2 { my $z = shift; 2 * 3 + $z }
And when this function is called, with the argument 4, it obviously returns the value 10.
You can also do emulation of currying another way, by doing things such as
sub plus_2 { $_[0] + 2 }
such that you have the same effect that you might achieve by writing
plus_2 = (+) 2
or somesuch in Haskell.
Of course, these examples aren't very useful in themselves, but the ideas are conceivably useful.
Disclaimer: not all the code here was tested.