<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1012874" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1012874</link>
    <description></description>
    <language>en</language>
          <item>
    <title>Don&#039;t get me wrong guys...</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1075567</link>
    <description> &lt;p&gt;I&#039;m not a total hash/Perl novice, I just sometimes miss obvious stuff.&lt;/p&gt;
&lt;p&gt;And the Perl manpages, while a good source of data, I feel that they are VERY confusing and hard to understand. That&#039;s why I prefer to ask the people hear about stuff.&lt;/p&gt;
 </description>
     <pubDate>Tue, 12 Dec 2000 04:56:05 +0000</pubDate>
 <dc:creator>Vorm</dc:creator>
 <guid isPermaLink="false">comment 1075567 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074858</link>
    <description> &lt;p&gt;thanks japhy,  I never knew about those functions... very usefull.&lt;/p&gt;
 </description>
     <pubDate>Fri, 01 Dec 2000 05:10:55 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1074858 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>defined() vs. exists()</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074693</link>
    <description> &lt;p&gt;Technically, you should be using &lt;strong&gt;exists()&lt;/strong&gt; to see if a key-value pair is found in a hash:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;%hash = ( foo =&amp;gt; undef );&lt;br /&gt;if ($hash{foo}) { print 1 }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not shown&lt;br /&gt;if (defined $hash{foo}) { print 2 }&amp;nbsp; # still not shown&lt;br /&gt;if (exists $hash{foo}) { print 3 }&amp;nbsp;&amp;nbsp; # shown&lt;br /&gt;if ($hash{bar}) { print 4 }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # not shown&lt;br /&gt;if (defined $hash{bar}) { print 5 }&amp;nbsp; # still not shown&lt;br /&gt;if (exists $hash{bar}) { print 6 }&amp;nbsp;&amp;nbsp; # still not shown&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Sun, 26 Nov 2000 04:38:33 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1074693 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074692</link>
    <description> &lt;p&gt;I wrote a few examples that will hopefully help you better understand hashes.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;strong&amp;gt;example 1&amp;lt;/strong&amp;gt;&lt;br /&gt;my %person_vidcard;&lt;br /&gt;&lt;br /&gt;$person_vidcard{Frank} = &amp;#039;Nvidia TNT 2&amp;#039;;&lt;br /&gt;$person_vidcard{Alex} = &amp;#039;Nvidia TNT&amp;#039;;&lt;br /&gt;$person_vidcard{Xena} = &amp;#039;Nvidia Geforce 2&amp;#039;;&lt;br /&gt;$person_vidcard{Guy} = &amp;#039;Voodoo 3&amp;#039;;&lt;br /&gt;&lt;br /&gt;#Voodoo 3&amp;#039;s suck, so we will delete Guy from the list&lt;br /&gt;delete $person_vidcard{Guy};&lt;br /&gt;foreach(sort keys %person_vidcard)&lt;br /&gt;{&lt;br /&gt;	print &amp;quot;$_ has a $person_vidcard{$_}\n&amp;quot;;&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;output:&lt;br /&gt;Alex has a Nvidia TNT&lt;br /&gt;Frank has a Nvidia TNT 2&lt;br /&gt;Xena has a Nvidia Geforce 2&lt;br /&gt;&lt;br /&gt;&amp;lt;strong&amp;gt;example 2&amp;lt;/strong&amp;gt;&lt;br /&gt;my %name_age = (&lt;br /&gt;	Donna =&amp;gt; 45,&lt;br /&gt;	Sammy =&amp;gt; 32,&lt;br /&gt;	Mike&amp;nbsp; =&amp;gt; 22&lt;br /&gt;);&lt;br /&gt;#It is Mike&amp;#039;s birthday.&amp;nbsp; If he is found in the hash&lt;br /&gt;#1 more year will be added to his age&lt;br /&gt;if(defined $name_age{Mike})&lt;br /&gt;{&lt;br /&gt;	print &amp;quot;Mike is &amp;quot;.++$name_age{Mike};	&lt;br /&gt;}	&lt;br /&gt;&lt;br /&gt;output:&lt;br /&gt;Mike is 23&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Sun, 26 Nov 2000 04:19:13 +0000</pubDate>
 <dc:creator>Rob Pengelly</dc:creator>
 <guid isPermaLink="false">comment 1074692 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>On quoting hash keys...</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074661</link>
    <description> &lt;p&gt;If you read the &#039;perldata&#039; documentation, you&#039;ll see:&lt;/p&gt;
&lt;p&gt;an identifier within such curlies is forced to be a string,&lt;br /&gt;
as is any single identifier within a hash subscript.  Our&lt;br /&gt;
earlier example, &lt;strong&gt;$days{&#039;Feb&#039;}&lt;/strong&gt; can be written as &lt;strong&gt;$days{Feb}&lt;/strong&gt;&lt;br /&gt;
and the quotes will be assumed automatically.  But anything&lt;br /&gt;
more complicated in the subscript will be interpreted as an&lt;br /&gt;
expression.&lt;/p&gt;
&lt;p&gt;[...]&lt;/p&gt;
&lt;p&gt;It is often more readable to use the =&amp;gt; operator between&lt;br /&gt;
key/value pairs.  The =&amp;gt; operator is mostly just a more&lt;br /&gt;
visually distinctive synonym for a comma, but it also&lt;br /&gt;
arranges for its left-hand operand to be interpreted as a&lt;br /&gt;
string--if it&#039;s a bareword that would be a legal identifier.&lt;br /&gt;
This makes it nice for initializing hashes:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;nbsp; %map = (&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; red&amp;nbsp;&amp;nbsp; =&amp;gt; 0x00f,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; blue&amp;nbsp; =&amp;gt; 0x0f0,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; green =&amp;gt; 0xf00,&lt;br /&gt;&amp;nbsp; );&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Sat, 25 Nov 2000 15:54:15 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1074661 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074654</link>
    <description> &lt;p&gt;why?&lt;br /&gt;
you don&#039;t access them by numbers (usually, I guess you could give them # names...), so how would perl know what to name the next &#039;element&#039;?&lt;/p&gt;
 </description>
     <pubDate>Sat, 25 Nov 2000 08:16:27 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1074654 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074650</link>
    <description> &lt;p&gt;This is sorta off topic, but don&#039;t you have to &#039;&#039; those hash keys Japhy? Or am I wrong again?&lt;/p&gt;
&lt;p&gt;Your answer does make sense, I guess I just didn&#039;t think out of the box. I mean, it does seem logical that hashes would have a push, doesn&#039;t it?&lt;/p&gt;
 </description>
     <pubDate>Sat, 25 Nov 2000 06:18:55 +0000</pubDate>
 <dc:creator>Vorm</dc:creator>
 <guid isPermaLink="false">comment 1074650 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Hashes are not ordered!</title>
    <link>https://www.webmaster-forums.net/serverside-scripting/need-some-basic-hash-help#comment-1074647</link>
    <description> &lt;p&gt;You need to read the &#039;perldata&#039; documentation.  A good place to start is &lt;a href=&quot;http://www.perldoc.com/&quot; class=&quot;bb-url&quot;&gt;http://www.perldoc.com/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There is no &quot;beginning&quot; or &quot;end&quot; of a hash -- at least, not one that you are thinking of, or have control over.  Hashes return their data in an order that is determined by Perl&#039;s source code, not you.&lt;/p&gt;
&lt;p&gt;That being said, there is no &lt;strong&gt;push()&lt;/strong&gt; equivalent for hashes.  Just create a new key-value pair:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;my %hash = (&lt;br /&gt;&amp;nbsp; EFnet =&amp;gt; &amp;#039;irc.core.com&amp;#039;,&lt;br /&gt;&amp;nbsp; DALnet =&amp;gt; &amp;#039;liberty.nj.us.dal.net&amp;#039;,&lt;br /&gt;);&lt;br /&gt;$hash{EFnet} = &amp;#039;irc.prison.net&amp;#039;;&amp;nbsp; # changing existing value&lt;br /&gt;$hash{Undernet} = &amp;#039;us.undernet.org&amp;#039;;&amp;nbsp; # adding new pair&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
 </description>
     <pubDate>Sat, 25 Nov 2000 05:06:04 +0000</pubDate>
 <dc:creator>japhy</dc:creator>
 <guid isPermaLink="false">comment 1074647 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
