[tpm] Subroutine arcana

Jim Graham james.a.graham at gmail.com
Mon May 14 09:03:02 PDT 2007


  Yes, use strict should nearly always be there, except for little test scripts :)

  - Jim

-----Original Message-----
From: Viktor Pavlenko [mailto:vvp at cogeco.ca] 
Sent: May 14, 2007 11:50 AM
To: Jim Graham
Cc: tpm at to.pm.org
Subject: Re: [tpm] Subroutine arcana

>>>>> "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