Illegal declaration of anonymous subroutine at ... (#2) (F) When using the sub keyword to construct an anonymous subroutine, you must always specify a block of code. See perlsub.