<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [Chicago-talk] print keys for anon hash</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2># for the first anonymous hash</FONT>
<BR><FONT SIZE=2>foreach my $key (keys %{$crew[0]}) {</FONT>
<BR><FONT SIZE=2>&nbsp; print &quot;found $key\n&quot;;</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2># for the second anonymous hash</FONT>
<BR><FONT SIZE=2>foreach my $key (keys %{$crew[1]}) {</FONT>
<BR><FONT SIZE=2>&nbsp; print &quot;found $key\n&quot;;</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>

<P><FONT SIZE=2># etc.</FONT>
</P>
<BR>

<P><FONT SIZE=2>-- Tim</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Dooley, Michael [<A HREF="mailto:Dooley.Michael@con-way.com">mailto:Dooley.Michael@con-way.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Monday, December 15, 2003 9:44 AM</FONT>
<BR><FONT SIZE=2>To: Chicago.pm chatter</FONT>
<BR><FONT SIZE=2>Subject: [Chicago-talk] print keys for anon hash</FONT>
</P>
<BR>

<P><FONT SIZE=2>How do I print out the keys for a specific anon hash?</FONT>
</P>

<P><FONT SIZE=2>if I say print $crew[0]{'name'},&quot;\n&quot;; I can get the name of a specific key</FONT>
<BR><FONT SIZE=2>but what if I wanted all the keys for that anon hash?</FONT>
</P>

<P><FONT SIZE=2>am I missing something?</FONT>
</P>

<P><FONT SIZE=2>#!/usr/bin/perl -w</FONT>
<BR><FONT SIZE=2>use strict;</FONT>
<BR><FONT SIZE=2>my @crew = (</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'Gilligan',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hat =&gt; 'White',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shirt=&gt;'red',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position=&gt;'first mate',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name =&gt; 'Skipper',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hat =&gt; 'Black',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shirt=&gt;'Blue',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position=&gt;'Captain',</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</FONT>
<BR><FONT SIZE=2>);</FONT>
</P>

<P><FONT SIZE=2>print keys ($crew[0]),&quot;\n&quot;;</FONT>
</P>

<P><FONT SIZE=2>[qgatu003]/export/home/mxdooley/perl_objects_references_modules/chap04$./tes</FONT>
<BR><FONT SIZE=2>t.pl</FONT>
<BR><FONT SIZE=2>Type of arg 1 to keys must be hash (not array element) at ./test.pl line 20,</FONT>
<BR><FONT SIZE=2>near &quot;])&quot;</FONT>
<BR><FONT SIZE=2>Execution of ./test.pl aborted due to compilation errors.</FONT>
</P>

<P><FONT SIZE=2>Mike</FONT>
<BR><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>Chicago-talk mailing list</FONT>
<BR><FONT SIZE=2>Chicago-talk@mail.pm.org</FONT>
<BR><FONT SIZE=2><A HREF="http://mail.pm.org/mailman/listinfo/chicago-talk" TARGET="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</A></FONT>
</P>
<BR>

<P><I><B><FONT SIZE=2>&quot;Bringing people together to advance their lives.&quot;</FONT></B></I> 
</P>

</BODY>
</HTML>