<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright Guru Labs, L.C. -->
<courselet>
<info>
  <supports releases="RHEL5 FC6"/>
</info>
<text>
  <title>Scalar Variables</title>
  <slide>
    <s1>Hold a single value</s1>
    <s1>Partially inspired by shell variables
        <s2><ct>$name = "Ted Reed";</ct></s2>
        <s2><ct>$count = 10;</ct></s2>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>scalar variables</h1>
      <p>scalar variables</p>
  </body>
</text>
<text>
  <title>Asking Perl For Help</title>
  <slide>
    <s1>Perl defaults to being overly permissive</s1>
    <s1>We can ask Perl to help us
        <s2>Additional warnings
            <example>use warnings;</example>
        </s2>
        <s2>Forbid unsafe operations
            <example>use strict;</example>
        </s2>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>Asking Perl For Help</h1>
      <p>Asking Perl For Help</p>
  </body>
</text>
<text>
  <title>use warnings;</title>
  <slide>
      <s1>Let us know when we've done something suspicious</s1>
      <s1>Example file
          <example>#!/usr/bin/perl
use warnings;
2+2;</example>
    </s1>
    <s1>Running the example
          <example>[guru@station1 ~]$ <ui><cmd>./warnings-test.pl</cmd></ui>
Useless use of a constant in void context at warnings-test.pl line 3.</example>
      </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>use warnings;</h1>
      <p>use warnings;</p>
  </body>
</text>
<text>
  <title>use strict;</title>
  <slide>
    <s1>Forbid potentially unsafe operations</s1>
    <s1>The most important restriction is variable declarations</s1>
    <s1>Perl variables are global by default, which is unsafe
        <example>$name = "Dax Kelson";</example></s1>
    <s1>The better choice is to use lexical variables
        <example>my $name = "Dax Kelson";</example></s1>
    <s1>The <ct>strict</ct> pragma makes undeclared use of globals an error
        <example>#!/usr/bin/perl
use strict;
$name = "Dax Kelson";</example></s1>
    <s1>The example won't run:
        <example>[sweeks@kweh ~]$ perl strict-test.pl
Global symbol "$name" requires explicit package name at strict-test.pl line 3.
Execution of strict-test.pl aborted due to compilation errors.
    </example></s1>
    </slide>
  <notes></notes>
  <body>
      <h1>use strict;</h1>
      <p>use strict;</p>
  </body>
</text>
<text>
  <title>Numbers</title>
  <slide>
    <s1>Perl doesn't care, it stores everything the same way internally
        <example>$count = 255;
$count = 0xff;
$count = 0b11111111;
$count = 2.55e2;
</example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>numbers</h1>
      <p>numbers</p>
  </body>
</text>
<text>
  <title>Strings</title>
  <slide>
    <s1>Perl is built around text</s1>
    <s1>Similar interpolation rules to bash
        <example>$message = 'You won $100'; # no interpolation
$message = "$user is over his quota"; # with interpolation</example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>strings</h1>
      <p>strings</p>
  </body>
</text>
<text>
  <title>Output With Print</title>
  <slide>
      <s1>The <ct>print</ct> function prints data to stdout by default
          <example>print "Hello, world!\n"; # literal string
print $message, "\n"; # from a variable</example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>output with print</h1>
      <p>output with print</p>
  </body>
</text>
<text>
  <title>if</title>
  <slide>
    <s1>The basic control structure
        <example>if ($size &lt; 10) {
    print "Not very big\n";
}
elsif ($size &lt; 100) {
    print "Medium sized\n";
}
else {
    print "Very big!\n";
}</example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>if</h1>
      <p>if</p>
  </body>
</text>
<text>
  <title>Conditional Ops</title>
  <slide>
      <s1>Numeric Comparisons
          <s2><ct>&lt; &gt; &lt;= &gt;= ==</ct></s2></s1>
      <s1>String Comparisons
          <s2><ct>lt gt le ge eq</ct></s2></s1>
      <s1>Logical Connectives
          <s2><ct>&amp;&amp; || and or</ct></s2></s1>
  </slide>
  <notes></notes>
  <body>
      <h1>Logical Ops</h1>
      <p>Logical Ops</p>
  </body>
</text>
<text>
  <title>Getting User Input</title>
  <slide>
    <s1>&lt;&gt; is the "Read from a File Handle" op</s1>
    <s1>Used in circumfix
        <example>my $color = &lt;STDIN&gt;;</example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>getting user input</h1>
      <p>getting user input</p>
  </body>
</text>
<text>
  <title>chomp</title>
  <slide>
    <s1>chomp</s1>
    <s1>chomp
        <example></example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>chomp</h1>
      <p>chomp</p>
  </body>
</text>
<text>
  <title>while</title>
  <slide>
    <s1>while</s1>
    <s1>while
        <example></example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>while</h1>
      <p>while</p>
  </body>
</text>
<text>
  <title>undef</title>
  <slide>
    <s1>undef</s1>
    <s1>undef
        <example></example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>undef</h1>
      <p>undef</p>
  </body>
</text>
<text>
  <title>defined</title>
  <slide>
    <s1>defined</s1>
    <s1>defined
        <example></example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>defined</h1>
      <p>defined</p>
  </body>
</text>
<text>
  <title>Getting Help</title>
  <slide>
    <s1>Getting Help</s1>
    <s1>Getting Help
        <example></example>
    </s1>
  </slide>
  <notes></notes>
  <body>
      <h1>Getting Help</h1>
      <p>Getting Help</p>
  </body>
</text>
</courselet>
