w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Arguments of anonymous subroutines in the BEGIN block

sub {} creates an anonymous subroutine and returns a reference to it (just as [] and {} do with arrays and hashes).

The $_[0], etc., are the arguments to that sub.

So if you call $hash{KEY1}->('foo','bar','baz'), $_[0] will be 'foo'.

The fact that the anonymous sub was generated at compile time isn't relevant.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.