<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>killianfaughnan.com &#187; arrays</title>
	<atom:link href="http://killianfaughnan.com/tag/arrays/feed/" rel="self" type="application/rss+xml" />
	<link>http://killianfaughnan.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 23 Feb 2011 09:05:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Perl Loop Basics</title>
		<link>http://killianfaughnan.com/2008/11/12/perl-loop-basics/</link>
		<comments>http://killianfaughnan.com/2008/11/12/perl-loop-basics/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 08:11:28 +0000</pubDate>
		<dc:creator>kfaughnan</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[foreach]]></category>
		<category><![CDATA[loops]]></category>

		<guid isPermaLink="false">http://killianfaughnan.com/?p=16</guid>
		<description><![CDATA[For loop The below will print &#8220;Hello!&#8221; 10 times: for ($i = 0; $i &#38;lt; 10 ; $i++){ print "Hello!n"; } Output: Hello! Foreach loop For iterating through an array it can be handy to use a foreach loop. In the example below the foreach loop will access each variables in the array and allow [...]]]></description>
			<content:encoded><![CDATA[<h3>For loop</h3>
<p>The below will print &#8220;Hello!&#8221; 10 times:</p>
<pre>  for ($i = 0; $i &amp;lt; 10 ; $i++){   print "Hello!n"; }</pre>
<pre>  Output: Hello!</pre>
<h3>Foreach loop</h3>
<p>For iterating through an array it can be handy to use a foreach loop. In the example below the foreach loop will access each variables in the array and allow you to use it as $i:</p>
<pre>  @array = ('one','two','three');</pre>
<pre>  foreach $i (@array) {   print "$i, "; }</pre>
<pre>  Output: one, two, three,</pre>
]]></content:encoded>
			<wfw:commentRss>http://killianfaughnan.com/2008/11/12/perl-loop-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl Array Basics</title>
		<link>http://killianfaughnan.com/2008/11/12/perl-array-basics/</link>
		<comments>http://killianfaughnan.com/2008/11/12/perl-array-basics/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 23:40:22 +0000</pubDate>
		<dc:creator>kfaughnan</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[push]]></category>

		<guid isPermaLink="false">http://killianfaughnan.com/?p=1</guid>
		<description><![CDATA[Initialising or clearing an array To create a new array it is as simple as declaring it as shown below. This method can also be used to clear an existing array, though you will have to drop the my. my @array = (); Creating an array with predefined elements To create a new array with [...]]]></description>
			<content:encoded><![CDATA[<h3>Initialising or clearing an array</h3>
<p>To create a new array it is as simple as declaring it as shown below. This method can also be used to clear an existing array, though you will have to drop the my.</p>
<pre>my @array = ();</pre>
<h3>Creating an array with predefined elements</h3>
<p>To create a new array with elements just declare the array with a comma delimited list in brackets after it.</p>
<pre>my @array = (hendrix,santana,young,clapton);</pre>
<h3>Adding elements to the end of an array with push()</h3>
<p>In this example we will add new elements to an array using the <a title="Perl Push Function" href="http://perldoc.perl.org/functions/push.html" target="_blank">push()</a> function. To do this we will use a loop to push elements from an existing array @array into our new array cleverly named&#8230;@newarray. The variable $item represents the value of the currently accessed element in @array</p>
<pre>my @array = (hendrix,santana,young,clapton);</pre>
<pre>my @newarray = ();</pre>
<pre>foreach my $item (@array) {</pre>
<pre>  push( @newarray,$item);</pre>
<pre>}</pre>
]]></content:encoded>
			<wfw:commentRss>http://killianfaughnan.com/2008/11/12/perl-array-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

