Advertisement
hakonhagland

perldoc -f my

Jul 25th, 2015
561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. my VARLIST
  2. my TYPE VARLIST
  3. my VARLIST : ATTRS
  4. my TYPE VARLIST : ATTRS
  5. A "my" declares the listed variables to be local (lexically) to
  6. the enclosing block, file, or "eval". If more than one variable is
  7. listed, the list must be placed in parentheses.
  8.  
  9. The exact semantics and interface of TYPE and ATTRS are still
  10. evolving. TYPE may be a bareword, a constant declared with "use
  11. constant", or "__PACKAGE__". It is currently bound to the use of
  12. the "fields" pragma, and attributes are handled using the
  13. "attributes" pragma, or starting from Perl 5.8.0 also via the
  14. "Attribute::Handlers" module. See "Private Variables via my()" in
  15. perlsub for details, and fields, attributes, and
  16. Attribute::Handlers.
  17.  
  18. Note that with a parenthesised list, "undef" can be used as a
  19. dummy placeholder, for example to skip assignment of initial
  20. values:
  21.  
  22. my ( undef, $min, $hour ) = localtime;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement