my keyword in Perl declares the listed variable to be local to the enclosing block in which it is defined. The purpose of my is to define static scoping. This can be used to use the same variable name multiple times but with different values.
Note: To specify more than one variable under my keyword, parentheses are used.
Syntax: my variable
variable: to be defined as local
does not return any value.
Geeks for Geeks This is in Function Geeks for Geeks Geeks for Geeks
Welcome to Geeks Let's GO Geeky!!! Welcome to Geeks Welcome to Geeks
How to define dynamic scoping?
The opposite of “my” is “local”. The local keyword defines dynamic scoping.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.