<?xml version="1.0" encoding="windows-1252"?>
<node id="575925" title="Re: shift vs @_" created="2006-10-02 14:36:00" updated="2006-10-02 10:36:00">
<type id="11">
note</type>
<author id="133383">
grep</author>
<data>
<field name="doctext">
I will often use multiple &lt;code&gt;shift&lt;/code&gt;s if I want to short circuit a sub when a non-true value is passed.

&lt;code&gt;
sub foo {
  my $bar = shift || return;
  my $baz = shift || return '&lt;p style="font-color:red"&gt;BAD&lt;/p&gt;';

} 
&lt;/code&gt;
&lt;p&gt;
Again I'll note that this works only for non-true values, IOW if 0(zero) is acceptable then don't do this.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-133383"&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;A HREF="/index.pl?node_id=133383&amp;lastnode_id=1072"&gt;grep&lt;/A&gt;
&lt;table align="left" cellpadding="6"&gt;&lt;tr&gt;
&lt;td bgcolor="#000000"&gt;
&lt;font color="#33CC33"&gt;&lt;tt&gt;Mynd you, m&amp;#248;nk bites Kan be pretti nasti...&lt;/tt&gt;&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
575918</field>
<field name="parent_node">
575918</field>
</data>
</node>
