<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.10" -->
<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/"
	>

<channel>
	<title>Perl Tips Blog from Bay View Training</title>
	<link>http://www.bayview.com/blog</link>
	<description>Bay View Consulting Services, Inc.</description>
	<pubDate>Tue, 06 May 2008 17:48:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.10</generator>
	<language>en</language>
			<item>
		<title>October 2008 Perl training</title>
		<link>http://www.bayview.com/blog/2008/05/06/october-2008-perl-training/</link>
		<comments>http://www.bayview.com/blog/2008/05/06/october-2008-perl-training/#comments</comments>
		<pubDate>Tue, 06 May 2008 17:22:10 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/2008/05/06/october-2008-perl-training/</guid>
		<description><![CDATA[We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale, CA.  The dates are:

Perl 101 - October 4
Perl 201 - October 11

Sign up early for the early bird discount ($50 off) and take an extra 10% off if you enroll in [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale, CA.  The dates are:</p>
<ul>
<li>Perl 101 - October 4</li>
<li>Perl 201 - October 11</li>
</ul>
<p>Sign up early for the early bird discount ($50 off) and take an extra 10% off if you enroll in more than class at once, or enroll as a group with one or more other people (limit one 10% discount per person).  Email <a href="mailto:enroll@bayview.com">enroll@bayview.com</a> today for more information.</p>
<p>If these dates don&#8217;t work for you, please feel free to contact us to discuss alternate dates, or for one-on-one coaching or on-site training at your location.  We can be very flexible with scheduling to accommodate your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2008/05/06/october-2008-perl-training/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Classes Coming Soon: Shell and Regular Expressions</title>
		<link>http://www.bayview.com/blog/2007/11/07/new-classes-coming-soon-shell-and-regular-expressions/</link>
		<comments>http://www.bayview.com/blog/2007/11/07/new-classes-coming-soon-shell-and-regular-expressions/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 23:40:03 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/2007/11/07/new-classes-coming-soon-shell-and-regular-expressions/</guid>
		<description><![CDATA[We are planning to debut several new classes soon&#8230;

Shell 101 - Using the Unix/Linux command line, including Bourne shell, tcsh, and text-processing utilities
Shell 201 - Writing shell scripts in Bourne Again Shell (bash)
Regex 101 - All about regular expressions, including grep, text editing (vi or emacs), Perl, and more

If you have any comments, questions, or [...]]]></description>
			<content:encoded><![CDATA[<p>We are planning to debut several new classes soon&#8230;</p>
<ul>
<li>Shell 101 - Using the Unix/Linux command line, including Bourne shell, tcsh, and text-processing utilities</li>
<li>Shell 201 - Writing shell scripts in Bourne Again Shell (bash)</li>
<li>Regex 101 - All about regular expressions, including grep, text editing (vi or emacs), Perl, and more</li>
</ul>
<p>If you have any comments, questions, or suggestions please let us know by email at <a href="mailto:training@bayview.com">training@bayview.com</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2007/11/07/new-classes-coming-soon-shell-and-regular-expressions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Upcoming Perl Training</title>
		<link>http://www.bayview.com/blog/2007/06/12/july-perl-training/</link>
		<comments>http://www.bayview.com/blog/2007/06/12/july-perl-training/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 06:52:09 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/2007/06/12/july-perl-training/</guid>
		<description><![CDATA[We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale.  The dates are:
Perl 101 - September 22
Perl 201 - October 6 and 20 (two half-day classes)
Sign up early for the early bird discount ($50 off all-day classes or $30 off half-day [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale.  The dates are:</p>
<p>Perl 101 - September 22<br />
Perl 201 - October 6 and 20 (two half-day classes)</p>
<p>Sign up early for the early bird discount ($50 off all-day classes or $30 off half-day classes) and take an extra 10% off if you enroll in more than class at once, or enroll as a group with one or more other people (limit one 10% discount).  Email <a href="mailto:enroll@bayview.com">enroll@bayview.com</a> today for more information.</p>
<p>If these dates don&#8217;t work for you, please feel free to contact us to discuss alternate dates, or for one-on-one coaching or on-site training at your location.  We can be very flexible with scheduling to accommodate your needs.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2007/06/12/july-perl-training/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Perl Training in June</title>
		<link>http://www.bayview.com/blog/2007/05/02/perl-training-in-june/</link>
		<comments>http://www.bayview.com/blog/2007/05/02/perl-training-in-june/#comments</comments>
		<pubDate>Thu, 03 May 2007 00:18:02 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/2007/05/02/perl-training-in-june/</guid>
		<description><![CDATA[Sign up now for Perl 101 and Perl 201.  They will be held on June 9 and 16, respectively.  Both classes are held on Saturdays from 9am-6pm in Sunnyvale.  Sign up by May 25 to get early bird pricing.  For more information give us a call at 650 279-9904 or email [...]]]></description>
			<content:encoded><![CDATA[<p>Sign up now for Perl 101 and Perl 201.  They will be held on June 9 and 16, respectively.  Both classes are held on Saturdays from 9am-6pm in Sunnyvale.  Sign up by May 25 to get early bird pricing.  For more information give us a call at 650 279-9904 or email training@bayview.com.  We can also deliver the training at your workplace if you have a group who need to learn Perl.  Contact us today for details.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2007/05/02/perl-training-in-june/feed/</wfw:commentRss>
		</item>
		<item>
		<title>New Perl Training Dates</title>
		<link>http://www.bayview.com/blog/2007/01/08/new-perl-training-dates/</link>
		<comments>http://www.bayview.com/blog/2007/01/08/new-perl-training-dates/#comments</comments>
		<pubDate>Mon, 08 Jan 2007 20:41:37 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/?p=28</guid>
		<description><![CDATA[We are pleased to announce dates for the Perl 101 and 201 classes.  This is the first offering of these classes in 2007.  They will be held on February 10 (Perl 101) and 24 (Perl 201) in Sunnyvale.  Please sign up by January 26 to take advantage of the early bird price. [...]]]></description>
			<content:encoded><![CDATA[<p>We are pleased to announce dates for the Perl 101 and 201 classes.  This is the first offering of these classes in 2007.  They will be held on February 10 (Perl 101) and 24 (Perl 201) in Sunnyvale.  Please sign up by January 26 to take advantage of the early bird price.  For more information give us a call at 650 279-9904 or email <a href="mailto:training@bayview.com">training@bayview.com</a>.  These classes are open to the public.  But if you have a group of people who need to learn Perl, we can also provide on-site training at your company - just let us know and we will put together a package just for you.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2007/01/08/new-perl-training-dates/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Perl Classes in April 2008</title>
		<link>http://www.bayview.com/blog/2007/01/03/perl-classes-in-april-2008/</link>
		<comments>http://www.bayview.com/blog/2007/01/03/perl-classes-in-april-2008/#comments</comments>
		<pubDate>Wed, 03 Jan 2007 20:35:50 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/2007/11/07/perl-classes-in-january-2008/</guid>
		<description><![CDATA[We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale, CA.  The dates are:

Perl 101 - April 19
Perl 201 - April 26

Sign up early for the early bird discount ($50 off) and take an extra 10% off if you enroll in [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve picked the dates for our next Perl training classes.  They will be held on Saturdays, from 9am to 6pm, in Sunnyvale, CA.  The dates are:</p>
<ul>
<li>Perl 101 - April 19</li>
<li>Perl 201 - April 26</li>
</ul>
<p>Sign up early for the early bird discount ($50 off) and take an extra 10% off if you enroll in more than class at once, or enroll as a group with one or more other people (limit one 10% discount per person).  Email <a href="mailto:enroll@bayview.com">enroll@bayview.com</a> today for more information.</p>
<p>If these dates don&#8217;t work for you, please feel free to contact us to discuss alternate dates, or for one-on-one coaching or on-site training at your location.  We can be very flexible with scheduling to accommodate your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2007/01/03/perl-classes-in-april-2008/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Platform-Specific Perl</title>
		<link>http://www.bayview.com/blog/2006/10/02/platform-specific-perl/</link>
		<comments>http://www.bayview.com/blog/2006/10/02/platform-specific-perl/#comments</comments>
		<pubDate>Tue, 03 Oct 2006 04:29:36 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Perl Tips</category>

		<category>Files &#038; Directories</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/?p=26</guid>
		<description><![CDATA[As an interpreted language, Perl scripts can generally be run unmodified on any platform.  But there are situations where the differences between platforms make it necessary to test what platform you are running on and act accordingly.
Say, for example, that you need to change permissions on a file.  On Unix and related operating [...]]]></description>
			<content:encoded><![CDATA[<p>As an interpreted language, Perl scripts can generally be run unmodified on any platform.  But there are situations where the differences between platforms make it necessary to test what platform you are running on and act accordingly.<a id="more-26"></a></p>
<p>Say, for example, that you need to change permissions on a file.  On Unix and related operating systems (including Mac OS X and Linux) you would use the <tt>chmod</tt> function, but that doesn&#8217;t do much on Windows.  Although the <tt>chmod</tt> command will execute on Windows it doesn&#8217;t do much.  Traditional FAT filesystems have only four attributes per file: archived (A), read-only (R), hidden (H), and system (S). These can be checked and set with the <a href="http://search.cpan.org/perldoc?Win32%3A%3AFile">Win32::File</a> module.  For NTFS, use <a href="http://search.cpan.org/perldoc?Win32%3A%3AFileSecurity">Win32::FileSecurity</a>.<br />
(For more information about Perl on Windows, see the <a href="http://www.perl.com/doc/FAQs/nt/perlwin32faq4.html">Perl Win32 FAQ</a>.)</p>
<p>So, in your program, if you want to be able to do one thing on Windows and another on Unix-like systems, you need to test what platform you are on.  The way to do that in Perl is to look at the special variable <tt>$^O</tt>.  (That&#8217;s the letter <tt>O</tt>, not the number <tt>0</tt>).  If you&#8217;re on Windows, it will have the value &#8220;MSWin32&#8243; (sadly, it doesn&#8217;t give you any clue what version of Windows you&#8217;re on).  So you would do something like this:</p>
<pre>if ($^O eq &quot;MSWin32&quot;) {
    require Win32::FileSecurity;
    Win32::FileSecurity::Set($file, { ... })
        or die &quot;Error in FileSecurity for $file: $^E&quot;;
}
else {
    chmod 0644, $file
        or die &quot;Error in chmod for $file: $!&quot;;
}</pre>
<p>To find out what the value of $^O is on your platform, run this little command from your shell:</p>
<pre>perl -e &quot;print $^O&quot;;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2006/10/02/platform-specific-perl/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Number::Format 1.52 now on SourceForge</title>
		<link>http://www.bayview.com/blog/2006/09/21/numberformat-152-now-on-sourceforge/</link>
		<comments>http://www.bayview.com/blog/2006/09/21/numberformat-152-now-on-sourceforge/#comments</comments>
		<pubDate>Thu, 21 Sep 2006 23:41:08 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/?p=25</guid>
		<description><![CDATA[The Number::Format module is now a SourceForge.net project and we have just released our first version there, which is version 1.52.  It fixes a minor bug in the format_price subroutine which caused errors during the running of the test suite.  The project, originally written by Bay View Consulting&#8217;s Bill Ward, now has several [...]]]></description>
			<content:encoded><![CDATA[<p>The Number::Format module is now a SourceForge.net project and we have just released our first version there, which is version 1.52.  It fixes a minor bug in the format_price subroutine which caused errors during the running of the test suite.  The project, originally written by Bay View Consulting&#8217;s Bill Ward, now has several developers working on it and we plan a new release.  Also, a Template Toolkit plugin and a JavaScript version have been included in the project.  For more information visit the project&#8217;s <a href="http://sourceforge.net/projects/number-format/">page on SourceForge</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2006/09/21/numberformat-152-now-on-sourceforge/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ignorance is Bliss - non-memorizing parentheses</title>
		<link>http://www.bayview.com/blog/2006/04/20/ignorance-is-bliss-non-memorizing-parentheses/</link>
		<comments>http://www.bayview.com/blog/2006/04/20/ignorance-is-bliss-non-memorizing-parentheses/#comments</comments>
		<pubDate>Thu, 20 Apr 2006 22:07:39 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Perl Tips</category>

		<category>Regular Expressions</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/?p=24</guid>
		<description><![CDATA[One of regular expressions&#8217; most useful features is memorization.  To do this, just put parentheses around part of your expression and the result will be memorized:
my($name) = /hello, (\w+)/
In this example, we look in $_ for the word &#8220;hello&#8221; followed by a comma, space, and a word.  Since the word, \w+, has parentheses [...]]]></description>
			<content:encoded><![CDATA[<p>One of regular expressions&#8217; most useful features is memorization.  To do this, just put parentheses around part of your expression and the result will be memorized:</p>
<blockquote><p><code>my($name) = /hello, (\w+)/</code></p></blockquote>
<p>In this example, we look in <code>$_</code> for the word &#8220;hello&#8221; followed by a comma, space, and a word.  Since the word, <code>\w+</code>, has parentheses around it, the part of the string that it matches gets memorized.  In this example, we are assigning the return value of the regular expression match to <code>$name</code>.  So if <code>$_</code> contains &#8220;hello, world&#8221; then $name gets &#8220;world&#8221; - very convenient.</p>
<p>But parentheses also do other things besides memorize their contents, and this feature can become annoying.  Here&#8217;s an example.<a id="more-24"></a></p>
<p>In a regular expression the <code>|</code> symbol indicates &#8220;or&#8221; - either the stuff to the left of it <em>or</em> the stuff to the right of it will match.  For example, <code>/hello|hi/</code> will match either &#8220;hello&#8221; or &#8220;hi&#8221; in the string.  You can even have more than one of these: <code>/hello|hi|howdy|greetings/</code> will match any of those four words.</p>
<p>The trouble is, what if you want the &#8220;or&#8221; to apply to only <em>part</em> of the string?  That&#8217;s where parentheses come in.  Let&#8217;s combine the previous two examples to show what I mean:</p>
<blockquote><p><code>my($name) = /(hello|hi|howdy|greetings), (\w+)/</code></p></blockquote>
<p>In this example, we want any of &#8220;hello,&#8221; &#8220;hi,&#8221; &#8220;howdy,&#8221; or &#8220;greetings&#8221;, followed by a comma, space, and a word which is memorized.  The problem is, the greeting word is also memorized, and so <code>$name</code> gets that word instead of the name that we want it to get!</p>
<p>The easy solution is to allocate a variable for that word:</p>
<blockquote><p><code>my($x, $name) = /<strong>(hello|hi|howdy|greetings)</strong>, (\w+)/</code></p></blockquote>
<p>But here, we don&#8217;t care about the value in <code>$x</code> so why bother allocating a variable for it?  Can&#8217;t get just this one benefit of parentheses without having them memorize anything?  For years, the answer was no.  But then a few years back the Perl regex guys came up with a syntax to do it - just add <code>?:</code> to the beginning of the parenthesized block, making it:</p>
<blockquote><p><code>my($name) = /(<strong>?:</strong>hello|hi|howdy|greetings), (\w+)/</code></p></blockquote>
<p>Gee, that was awfully obvious, wasn&#8217;t it?  <strong>NOT!</strong>  <em>Why do they have to make these things so unintelligible?</em> I hear you cry.</p>
<p>The answer is backward compatibility.  Think about it - all the obvious characters already mean something, or if they don&#8217;t, chances are someone&#8217;s used them in a regular expression already to search for that character.  So the <em>only</em> way to introduce a new feature into regular expressions is to use something that previously was a syntax error.  Since the &#8220;<code>?</code>&#8221; character in a regex means &#8220;the previous thing zero or one times&#8221; and the thing before the &#8220;<code>?</code>&#8221; in this syntax is &#8220;<code>(</code>&#8221; (which if you recall means &#8220;start memorizing here&#8221;), it didn&#8217;t make sense to say &#8220;start memorizing here, zero or one times&#8221; so it was a syntax error.  Since it was an error, nobody would have used it in an existing Perl script.  So by giving <code>(?</code> a meaning that wasn&#8217;t a syntax error, backward compatibility is preserved.</p>
<p>But why &#8220;<code>(?:</code>&#8221; and not just &#8220;<code>(?</code>&#8220;?  I wasn&#8217;t there, but I would assume they wanted to add more features to the parenthesized syntax and were running out of previously-bad syntax that they could give meaning to.  For example, you may know that you can make a regex case-insensitive by adding <code>/i</code> to the end.  Well, you can also insert the &#8220;<code>i</code>&#8221; between the &#8220;<code>?</code>&#8221; and &#8220;<code>:</code>&#8221; to make only part of the regex be case-insensitive: <code>/(?i:hello|hi), world/</code> would allow &#8220;hello&#8221; or &#8220;HELLO&#8221; but &#8220;world&#8221; would have to be all lowercase.</p>
<p>So, the bottom line: if you find yourself wanting to use parentheses in your regex for reasons other than memorizing, and memorizing gets in your way (or you want to save a little on performance, since memorizing can slow things down a little), then just remember to insert <code>?:</code> at the start of the parenthesized part of your pattern.</p>
<blockquote><p><code>my($name) = /(?:hello|hi|howdy|greetings), (\w+)/</code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2006/04/20/ignorance-is-bliss-non-memorizing-parentheses/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Perl Tips now available in blog form</title>
		<link>http://www.bayview.com/blog/2006/01/21/perl-tips-now-available-in-blog-form/</link>
		<comments>http://www.bayview.com/blog/2006/01/21/perl-tips-now-available-in-blog-form/#comments</comments>
		<pubDate>Sat, 21 Jan 2006 10:31:03 +0000</pubDate>
		<dc:creator>William Ward</dc:creator>
		
		<category>Old News</category>

		<guid isPermaLink="false">http://www.bayview.com/blog/?p=23</guid>
		<description><![CDATA[The Perl Tips that were previously mere Web pages are now being presented in the form of a blog (short for &#8220;web log&#8221;).  What does this mean to you?  Several things:

You can subscribe to it via an RSS feed using your favorite feed reader, such as NewsGator (Windows) or NetNewsWire (Mac) or Mozilla [...]]]></description>
			<content:encoded><![CDATA[<p>The Perl Tips that were previously mere Web pages are now being presented in the form of a blog (short for &#8220;web log&#8221;).  What does this mean to you?  Several things:<a id="more-23"></a></p>
<ul>
<li>You can subscribe to it via an <a href="http://www.bayview.com/blog/feed/">RSS feed</a> using your favorite feed reader, such as <a href="http://newsgator.com/home.aspx">NewsGator</a> (Windows) or <a href="http://www.apple.com/downloads/macosx/internet_utilities/netnewswire.html">NetNewsWire</a> (Mac) or <a href="http://www.mozilla.com/thunderbird/">Mozilla Thunderbird</a> (any), or on the Web at a site like <a href="http://www.bloglines.com/">Bloglines</a> or <a href="http://my.yahoo.com/">My Yahoo</a>.</li>
<li>You can post comments!  Each Perl Tip is like a little bulletin board, where we can discuss the content of the tip, and maybe lead to other ideas.</li>
<li>If you&#8217;re interested in contributing a Perl Tip, we can even set up access for you to post here.</li>
<li>There should be more Perl Tips, since it&#8217;s now a lot less work for us to post them (remember, in Perl, laziness is a virtue)</li>
<li>If you have your own blog, you can trackback to our Perl Tips and News articles, which sets up a two-way link between your blog and ours.  This can help drive traffic to both your site and ours.</li>
</ul>
<p>To see the contents of the blog just click on the &#8220;Perl Tips&#8221; link on the left side or bookmark this URL: <a href="http://www.bayview.com/blog/">http://www.bayview.com/blog/</a></p>
<p>The blog is powered by <a href="http://www.wordpress.org">Wordpress</a>, which is actually a PHP application, but it works very well for this sort of thing.</p>
<p>Please send any comments, suggestions, questions, or other feedback to info@bayview.com.  Thanks!<br /><p>Technorati Tags: <a href="http://technorati.com/tag/Perl" rel="tag">Perl</a>, <a href="http://technorati.com/tag/Perl+Tips" rel="tag"> Perl Tips</a>, <a href="http://technorati.com/tag/Bay+View+Training" rel="tag"> Bay View Training</a>, <a href="http://technorati.com/tag/blogs" rel="tag"> blogs</a>, <a href="http://technorati.com/tag/blogging" rel="tag"> blogging</a>, <a href="http://technorati.com/tag/WordPress" rel="tag"> WordPress</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bayview.com/blog/2006/01/21/perl-tips-now-available-in-blog-form/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
