[tpm] Subroutine arcana

Viktor Pavlenko vvp at cogeco.ca
Mon May 14 08:50:23 PDT 2007

>>>>> "JG" == Jim Graham <james.a.graham at gmail.com> writes:

    JG> #-- define subroutines
    JG> sub named_sub
    JG> {
    JG>  #-- define a named and anon sub
    JG>  sub named_internal_sub
    JG>  {
    JG>   print "\t\tIn named_internal_sub with args: @_\n";
    JG>  }

Never thought that would work...

    JG>  #-- can make anon_sub private if we declare it "my". Otherwise
    JG>  #   it is globally visible

Provided there's no "use strict", which should always be
there... IMHO.

    JG>  $anon_sub = sub { print "\t\tIn internal anon sub: @_ \n"; };



More information about the toronto-pm mailing list