subs.html

来自「perl教程」· HTML 代码 · 共 61 行

HTML
61
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../displayToc.js"></script>
<script language="JavaScript" src="../tocParas.js"></script>
<script language="JavaScript" src="../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../scineplex.css">
<title>subs - Perl pragma to predeclare sub names</title>
<link rel="stylesheet" href="../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',1);</script>
<h1><a>subs - Perl pragma to predeclare sub names</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>subs - Perl pragma to predeclare sub names</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">subs</span> <span class="string">qw(frob)</span><span class="operator">;</span>
    <span class="variable">frob</span> <span class="number">3</span><span class="operator">..</span><span class="number">10</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This will predeclare all the subroutine whose names are 
in the list, allowing you to use them without parentheses
even before they're declared.</p>
<p>Unlike pragmas that affect the <a href="../lib/Pod/perlvar.html#item___h"><code>$^H</code></a> hints variable, the <code>use vars</code> and
<code>use subs</code> declarations are not BLOCK-scoped.  They are thus effective
for the entire file in which they appear.  You may not rescind such
declarations with <code>no vars</code> or <code>no subs</code>.</p>
<p>See <a href="../lib/Pod/perlmodlib.html#pragmatic_modules">Pragmatic Modules in the perlmodlib manpage</a> and <a href="../lib/strict.html#strict_subs">strict subs in the strict manpage</a>.</p>

</body>

</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?