<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Variables, Arrays, and Hash Tables</title>
	<atom:link href="http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powershellpro.com</link>
	<description>Sharing the Experience</description>
	<lastBuildDate>Fri, 03 Feb 2012 08:09:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Scott</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-1208</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Wed, 01 Feb 2012 16:20:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-1208</guid>
		<description>You still have not corrected the error about using +=, in your example after doing $strC = $strA += $strB if you do $StrA you will get &quot;Hello World!&quot;. Please update the tutorial as it is misleading.</description>
		<content:encoded><![CDATA[<p>You still have not corrected the error about using +=, in your example after doing $strC = $strA += $strB if you do $StrA you will get &#8220;Hello World!&#8221;. Please update the tutorial as it is misleading.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lori</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-1162</link>
		<dc:creator>Lori</dc:creator>
		<pubDate>Thu, 26 Jan 2012 22:00:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-1162</guid>
		<description>Question... 
To add a variable to the Hash Table, we put it in square brackets. To remove it, it was just in parens. Why the difference? 

Thanks!!</description>
		<content:encoded><![CDATA[<p>Question&#8230;<br />
To add a variable to the Hash Table, we put it in square brackets. To remove it, it was just in parens. Why the difference? </p>
<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TByrd</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-962</link>
		<dc:creator>TByrd</dc:creator>
		<pubDate>Fri, 30 Dec 2011 18:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-962</guid>
		<description>I am enjoying the tutorials. They are easy to understand, use good examples and have enough material, but not so much as to confuse.
However, I am a little unclear as to when to use the square brackets [], or the curly brackets {} or parens ().
Is there any rule or guide to assist with remembering which to use in which situations?</description>
		<content:encoded><![CDATA[<p>I am enjoying the tutorials. They are easy to understand, use good examples and have enough material, but not so much as to confuse.<br />
However, I am a little unclear as to when to use the square brackets [], or the curly brackets {} or parens ().<br />
Is there any rule or guide to assist with remembering which to use in which situations?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tiMMeH!</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-705</link>
		<dc:creator>tiMMeH!</dc:creator>
		<pubDate>Thu, 13 Oct 2011 04:48:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-705</guid>
		<description>Awesome tutorial. Really easy to understand and follow :)</description>
		<content:encoded><![CDATA[<p>Awesome tutorial. Really easy to understand and follow <img src='http://www.powershellpro.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randyl</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-679</link>
		<dc:creator>Randyl</dc:creator>
		<pubDate>Wed, 31 Aug 2011 23:09:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-679</guid>
		<description>In your &#039;Working with Strings&#039; section, &#039;string&#039; is misspelled in the following sentence: &quot;A [sting] is a “text string” data type&quot;.

I hope they didn&#039;t use &quot;sting&quot; as the type.</description>
		<content:encoded><![CDATA[<p>In your &#8216;Working with Strings&#8217; section, &#8217;string&#8217; is misspelled in the following sentence: &#8220;A [sting] is a “text string” data type&#8221;.</p>
<p>I hope they didn&#8217;t use &#8220;sting&#8221; as the type.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian R.</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-667</link>
		<dc:creator>Brian R.</dc:creator>
		<pubDate>Tue, 16 Aug 2011 15:42:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-667</guid>
		<description>I am trying to parse xml files from database exports to validate data in the database.

How do I get just the tag value when the tag as both attributes and values.

Sample XML
   
  
     
        00728cam a22002531 4500 
        100112 
        
           MP 0465.D 01 
        
     
  


Here is the code:

$VRPPath = &quot;C:\horizon\horizon-random-sample-formatted.xml&quot;
[xml]$VRLfile = Get-Content $VRPPath
foreach( $record in $VRLfile.collection.record)
{
    write-host &quot;leader = &quot;, $record.leader
    foreach( $cf in $record.controlfield)
    {
        write-host &quot;cf tags = &quot;, $cf.tag,&quot;  value: &quot;, $cf
        $cf
    }
}


OutPut:


leader =  01653nam a22002651 4500
cf tags =  001   value:  
001                                                      101396                                                 
``````````````````
In the second line of the output where the tag has attributes as well as a value, I can get the attribute values just fine but the tag value returned is null or empty.

In the 3rd line of the output, the tag value is returned as a table of attribute and value pairs.  I just need the value or text that is stored in the tag without any attribute values.</description>
		<content:encoded><![CDATA[<p>I am trying to parse xml files from database exports to validate data in the database.</p>
<p>How do I get just the tag value when the tag as both attributes and values.</p>
<p>Sample XML</p>
<p>        00728cam a22002531 4500<br />
        100112 </p>
<p>           MP 0465.D 01 </p>
<p>Here is the code:</p>
<p>$VRPPath = &#8220;C:\horizon\horizon-random-sample-formatted.xml&#8221;<br />
[xml]$VRLfile = Get-Content $VRPPath<br />
foreach( $record in $VRLfile.collection.record)<br />
{<br />
    write-host &#8220;leader = &#8220;, $record.leader<br />
    foreach( $cf in $record.controlfield)<br />
    {<br />
        write-host &#8220;cf tags = &#8220;, $cf.tag,&#8221;  value: &#8220;, $cf<br />
        $cf<br />
    }<br />
}</p>
<p>OutPut:</p>
<p>leader =  01653nam a22002651 4500<br />
cf tags =  001   value:<br />
001                                                      101396<br />
&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;&#8220;<br />
In the second line of the output where the tag has attributes as well as a value, I can get the attribute values just fine but the tag value returned is null or empty.</p>
<p>In the 3rd line of the output, the tag value is returned as a table of attribute and value pairs.  I just need the value or text that is stored in the tag without any attribute values.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-634</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Fri, 03 Jun 2011 04:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-634</guid>
		<description>Bob, Brent: Same problem. Changed to new variable, unused names, and it worked fine.</description>
		<content:encoded><![CDATA[<p>Bob, Brent: Same problem. Changed to new variable, unused names, and it worked fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-632</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 27 May 2011 15:57:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-632</guid>
		<description>Adding a record to a hash table is described in the section above as:

Add a new employee record:

$EmpNumbers[&quot;Rose Jones&quot;] = 445566

How would that work exactly? Rather than adding a record, this looks more like setting a record that has already been added.</description>
		<content:encoded><![CDATA[<p>Adding a record to a hash table is described in the section above as:</p>
<p>Add a new employee record:</p>
<p>$EmpNumbers["Rose Jones"] = 445566</p>
<p>How would that work exactly? Rather than adding a record, this looks more like setting a record that has already been added.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-603</link>
		<dc:creator>Brent</dc:creator>
		<pubDate>Thu, 14 Apr 2011 19:41:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-603</guid>
		<description>Same Bob. Try this:

$strComputers = @(&quot;Server1&quot;, &quot;Server2&quot;, &quot;Server3&quot;)
$strComputers2 = @(&quot;Server11&quot;, &quot;Server12&quot;, &quot;Server13&quot;)
$strAllComputers = $strComputers + $strComputers2
$strAllComputers</description>
		<content:encoded><![CDATA[<p>Same Bob. Try this:</p>
<p>$strComputers = @(&#8220;Server1&#8243;, &#8220;Server2&#8243;, &#8220;Server3&#8243;)<br />
$strComputers2 = @(&#8220;Server11&#8243;, &#8220;Server12&#8243;, &#8220;Server13&#8243;)<br />
$strAllComputers = $strComputers + $strComputers2<br />
$strAllComputers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/comment-page-1/#comment-592</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Fri, 25 Mar 2011 15:54:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershellpro.com/powershell-tutorial-introduction/variables-arrays-hashes/#comment-592</guid>
		<description>When trying to complete this part of the tutorial:

Using the + operator, we can combine arrays:
$x = @(1, 2, 3, 4, 5)
$y = @(6, 7, 8, 9, 10)
$z = $x + $y
$z

I get the following error:

Cannot convert the &quot;System.Object[]&quot; value of type &quot;System.Object[]&quot; to type &quot;System.Int32&quot;.  $x &lt;&lt;&lt;&lt;  = @(1,2,3,4,5)

Thanks,
Bob</description>
		<content:encoded><![CDATA[<p>When trying to complete this part of the tutorial:</p>
<p>Using the + operator, we can combine arrays:<br />
$x = @(1, 2, 3, 4, 5)<br />
$y = @(6, 7, 8, 9, 10)<br />
$z = $x + $y<br />
$z</p>
<p>I get the following error:</p>
<p>Cannot convert the &#8220;System.Object[]&#8221; value of type &#8220;System.Object[]&#8221; to type &#8220;System.Int32&#8243;.  $x &lt;&lt;&lt;&lt;  = @(1,2,3,4,5)</p>
<p>Thanks,<br />
Bob</p>
]]></content:encoded>
	</item>
</channel>
</rss>

