<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://htyp.org/mw/index.php?action=history&amp;feed=atom&amp;title=my_%28Perl_function%29</id>
	<title>my (Perl function) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://htyp.org/mw/index.php?action=history&amp;feed=atom&amp;title=my_%28Perl_function%29"/>
	<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;action=history"/>
	<updated>2026-09-11T22:29:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=4386&amp;oldid=prev</id>
		<title>Woozle: My (Perl function) moved to my (Perl function)</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=4386&amp;oldid=prev"/>
		<updated>2006-05-26T18:27:57Z</updated>

		<summary type="html">&lt;p&gt;My (Perl function) moved to my (Perl function)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:27, 26 May 2006&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
	<entry>
		<id>https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=3810&amp;oldid=prev</id>
		<title>Woozle: My (Perl) moved to My (Perl function)</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=3810&amp;oldid=prev"/>
		<updated>2006-04-07T23:37:12Z</updated>

		<summary type="html">&lt;p&gt;My (Perl) moved to My (Perl function)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:37, 7 April 2006&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
	<entry>
		<id>https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=3795&amp;oldid=prev</id>
		<title>Woozle at 17:52, 7 April 2006</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=my_(Perl_function)&amp;diff=3795&amp;oldid=prev"/>
		<updated>2006-04-07T17:52:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The [[built-in function (Perl)|built-in function]] {{perlfunc|my}}() in [[Perl]] creates a variable that is local to the current scope. That is, it is defined:&lt;br /&gt;
* within the current set of curly braces {}&lt;br /&gt;
* within any further curly braces that are within that current set (as one would expect)&lt;br /&gt;
&lt;br /&gt;
If a variable of the same name exists outside of the current scope, {{perlfunc|my}}() creates a new variable and ignores/preserves the older variable. &amp;#039;&amp;#039;Query: is there a way to access the older variable from inside this scope?&amp;#039;&amp;#039; The older variable is once again accessible when execution leaves the current scope.&lt;br /&gt;
&lt;br /&gt;
{{perlfunc|my}}() is very similar to {{perlfunc|local}}(), except that {{perlfunc|my}}() does not do dynamic scoping. {{perlfunc|my}}() is generally recommended over {{perlfunc|local}}(). (You may hear the saying &amp;quot;Don&amp;#039;t use local()&amp;quot; from experienced Perl programmers.)&lt;br /&gt;
==Versions==&lt;br /&gt;
* {{perlfunc|my}}() was introduced in Perl 5.&lt;br /&gt;
==Examples==&lt;br /&gt;
* my($avar,$anothervar);&lt;br /&gt;
* my($arg1,$arg2) = @_;&lt;br /&gt;
* my(%hashvar);&lt;br /&gt;
* my %anotherhash;&lt;br /&gt;
* my $justonevar;&lt;br /&gt;
* my @anArray;&lt;/div&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
</feed>