<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-211134735146872029</id><updated>2012-02-16T14:48:41.979+08:00</updated><category term='scalar'/><category term='use strict'/><category term='File handling'/><category term='basic perl'/><category term='loop'/><category term='variable'/><category term='do while'/><category term='operation'/><category term='for loop'/><category term='last'/><category term='continue'/><category term='concatenation'/><category term='redo'/><category term='perl'/><category term='hash'/><category term='perl reserved hashes'/><category term='perl reserved array'/><category term='regular expression'/><category term='learn perl'/><category term='pop'/><category term='array'/><category term='perl tutorial'/><category term='literals'/><category term='hello world'/><category term='conditional statements'/><category term='push'/><category term='perl subroutine'/><category term='do until'/><category term='perl reserved variables'/><category term='switches'/><category term='pragma'/><category term='assignment'/><category term='if'/><category term='interpolation'/><category term='next'/><category term='do'/><title type='text'>practical perl</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-2533299029195004360</id><published>2007-01-04T14:34:00.001+08:00</published><updated>2007-01-04T14:41:09.567+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl subroutine'/><title type='text'>Basic #13, Subroutines</title><content type='html'>&lt;span style="font-size:85%;"&gt;subroutines in Perl is declared like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;sub  testSub{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;    print "Hello World\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A call to the subroutine is made with an &amp; before the subroutine name, as in:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;&amp;testSub;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;&amp;testSub($_);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;&amp;testSub(5, $_);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Parameters passed to the subroutine can be referenced with &lt;span style="color: rgb(255, 0, 0);"&gt;@_&lt;/span&gt;, which have nothing to do with $_&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;sub printArguments{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;    print "&lt;span style="color: rgb(255, 0, 0);"&gt;@_&lt;/span&gt;";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;each individual parameter can also be referenced with &lt;span style="color: rgb(255, 0, 0);"&gt;$_[0]&lt;/span&gt;, &lt;span style="color: rgb(255, 0, 0);"&gt;$_[1]&lt;/span&gt;, etc&lt;br /&gt;** again $_[0], $_[1] has nothing to do with $_&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-2533299029195004360?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/2533299029195004360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=2533299029195004360&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/2533299029195004360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/2533299029195004360'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/basic-13-subroutines.html' title='Basic #13, Subroutines'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-3081146066147816083</id><published>2007-01-03T21:52:00.000+08:00</published><updated>2007-01-03T23:09:40.765+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regular expression'/><title type='text'>Intermediate #2, Regular Expressions Part 1</title><content type='html'>&lt;span style="font-size:85%;"&gt;regular expressions are used with the &lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;=~&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;e.g&lt;br /&gt;&lt;br /&gt;$string = "the cat is looking for food";&lt;br /&gt;print "yes" if($string &lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;=~&lt;/span&gt; m/cat/);&lt;br /&gt;&lt;br /&gt;m//  used for matching, return a boolean&lt;br /&gt;s///  used for substituting&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt;$string = "this is a cat";&lt;br /&gt;$string =~ s/cat/dog/;&lt;br /&gt;&lt;br /&gt;replaces the cat to dog&lt;br /&gt;&lt;br /&gt;* the separator / can be changed to any other characters e.g s#cat#dog#&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Metacharacter    Description&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \&lt;/span&gt;                                escape character&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    ^&lt;/span&gt;                                match beginning of string (or line if /m modifier)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    $&lt;/span&gt;                                match end of string (or line if /m modifier)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    .&lt;/span&gt;                                 match any character except \n&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    |                               &lt;/span&gt;specify alternate matches in []&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    ()&lt;/span&gt;                              groups expression together, each group become $1, $2, $3, etc&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    []&lt;/span&gt;                              looks for a set of characters&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;Sequence        Purpose&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \w&lt;/span&gt;                  alphanumeric characters including _&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt;\W                &lt;/span&gt;non-alphanumeric&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt;\s                    &lt;/span&gt;white space character&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt;\S                    &lt;/span&gt;non white space character&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt;\d                   &lt;/span&gt;digit&lt;br /&gt;   &lt;span style="color: rgb(255, 0, 0);"&gt;\D                  &lt;/span&gt;non-digit&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \b&lt;/span&gt;                   word boundary&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \B&lt;/span&gt;                  non word boundary&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \A&lt;/span&gt;              Matches only the beginning of a string&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \Z&lt;/span&gt;                  Matches only at end of string&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \G&lt;/span&gt;                 matches where previous m//g operation left off&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \t&lt;/span&gt;                   tab&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \n&lt;/span&gt;                  newline&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \r&lt;/span&gt;                   carriage return&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \f&lt;/span&gt;                    form feed&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \a&lt;/span&gt;                    alarm (bell)&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \e&lt;/span&gt;                    escape&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \b&lt;/span&gt;                    backspace&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \033&lt;/span&gt;             octal character&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \x1B&lt;/span&gt;            hex character&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \c[&lt;/span&gt;                  control character&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \l&lt;/span&gt;                     makes next character lowercase&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \u&lt;/span&gt;                   makes next character uppercase&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \L&lt;/span&gt;                   specify lowercase until \E&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \U&lt;/span&gt;                  specify uppercase until \E&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \E&lt;/span&gt;                    Ends case modification&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    \Q&lt;/span&gt;                  Quotes (disables) regexp metacharacters till \E&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Maximal&lt;/span&gt;            &lt;span style="color: rgb(51, 204, 0);"&gt;Minimal            &lt;/span&gt;Purpose&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    *&lt;/span&gt;                            &lt;span style="color: rgb(51, 204, 0);"&gt;*?                        &lt;/span&gt;Matches 0 or more items&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    +&lt;/span&gt;                          &lt;span style="color: rgb(51, 204, 0);"&gt;+?                        &lt;/span&gt;matches 1 or more items&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    ?&lt;/span&gt;                            &lt;span style="color: rgb(51, 204, 0);"&gt;??                        &lt;/span&gt;matches 0 or 1 item&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    {n}&lt;/span&gt;                    &lt;span style="color: rgb(51, 204, 0);"&gt;{n}?&lt;/span&gt;                      matches exactly n items&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    {n,}&lt;/span&gt;                  &lt;span style="color: rgb(51, 204, 0);"&gt;{n,}?&lt;/span&gt;                     matches at least n items&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    {n,m}             &lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;{n,m}?&lt;/span&gt;                 matches at least n, but not more than m items&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Maximal &lt;/span&gt;: matches maximum no of times&lt;br /&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;Minimal&lt;/span&gt;  : matches min no of times&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;Modifier        Description&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    g&lt;/span&gt;                    matches all occurrence within a string, not just the first&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    i&lt;/span&gt;                     case insensitive&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    m&lt;/span&gt;                for multi-line strings, ^ and $ match end of string instead of individual lines&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    o                  &lt;/span&gt;eval expression only once&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    s&lt;/span&gt;                    allow us of . to match newline character&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    x&lt;/span&gt;                  allows using of whitespace in expression for clarity&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    e&lt;/span&gt;                    eval replacement string as an expression(substitution only)&lt;br /&gt;&lt;br /&gt;*modifiers are put at the end of m// or s/// as e.g. m//g&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-3081146066147816083?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/3081146066147816083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=3081146066147816083&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/3081146066147816083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/3081146066147816083'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/intermediate-2-regular-expressions-part.html' title='Intermediate #2, Regular Expressions Part 1'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-7986139386856186257</id><published>2007-01-03T16:36:00.000+08:00</published><updated>2007-01-03T18:08:47.143+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='File handling'/><title type='text'>Intermediate #1, File Handling</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt;#!c:/www/perl/bin/perl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;$file = "D:/My Perls/data.txt";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;open(&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;INFILE&lt;/span&gt;, $file&lt;span style="color: rgb(255, 0, 0);"&gt;)&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;@lines = &lt;span style="color: rgb(51, 204, 0);"&gt;&amp;lt;INFILE&amp;gt;&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;close(&lt;/span&gt;&lt;span style="color: rgb(51, 204, 0);"&gt;INFILE&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;)&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;foreach(@lines){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;print &lt;span style="color: rgb(51, 51, 255);"&gt;$_&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;INFILE&lt;/span&gt; is the file handler, no quotes is to be added. It can be replaced with any arbitual names.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;infile&gt;&lt;infile\&gt;&lt;/infile\&gt;&lt;/infile&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&amp;lt;INFILE&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;infile&gt;&lt;infile\&gt;&lt;span style="font-size:85%;"&gt;reads in the entire file in one go, if a scalar variable is used instead of the array, then only the next line would be read in.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/infile\&gt;&lt;/infile&gt;&lt;/span&gt;&lt;pre&gt;&lt;span style="font-size:100%;"&gt;-----------------------------------------------------------------&lt;/span&gt;&lt;/pre&gt; &lt;pre&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-size:100%;"&gt;open(INFO, $file); # Open for input&lt;br /&gt;open(INFO, "&lt;span style="color: rgb(255, 0, 0);"&gt;&gt;&lt;/span&gt;$file"); # Open for &lt;span style="color: rgb(255, 0, 0);"&gt;output&lt;/span&gt;&lt;br /&gt;open(INFO, "&lt;span style="color: rgb(255, 0, 0);"&gt;&gt;&gt;&lt;/span&gt;$file"); # Open for &lt;span style="color: rgb(255, 0, 0);"&gt;appending&lt;/span&gt;&lt;br /&gt;open(INFO, "&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;&lt;/span&gt;$file"); # Also open for &lt;span style="color: rgb(255, 0, 0);"&gt;input     &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;*can add the - &lt;span style="color: rgb(51, 204, 0);"&gt;or die("error :".$!)&lt;/span&gt; for error handling &lt;br /&gt;----------------------------------------------------------------- &lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;if the file is already opened for output,&lt;br /&gt;we can print to the file with the print statement with an additional parameter : &lt;br /&gt;&lt;br /&gt;print &lt;span style="color: rgb(255, 0, 0);"&gt;INFO &lt;/span&gt;"END OF FILE\n"; &lt;br /&gt;&lt;br /&gt;-----------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;Standard Input and Output:  &lt;br /&gt;open(INFO, '&lt;span style="color: rgb(255, 0, 0);"&gt;-&lt;/span&gt;'); # Open &lt;span style="color: rgb(255, 0, 0);"&gt;standard input&lt;/span&gt;&lt;br /&gt;open(INFO, '&lt;span style="color: rgb(255, 0, 0);"&gt;&gt;-&lt;/span&gt;'); # Open &lt;span style="color: rgb(255, 0, 0);"&gt;standard output&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-7986139386856186257?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/7986139386856186257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=7986139386856186257&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7986139386856186257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7986139386856186257'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/intermediate-1-file-handling.html' title='Intermediate #1, File Handling'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-971225296898756367</id><published>2007-01-03T16:28:00.000+08:00</published><updated>2007-01-03T16:36:10.304+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='next'/><category scheme='http://www.blogger.com/atom/ns#' term='redo'/><category scheme='http://www.blogger.com/atom/ns#' term='last'/><title type='text'>Basic #12, loop controls</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;next &lt;/span&gt;- skips remainder of the code block, forcing the loop to proceed to the next value in the loop.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;last &lt;/span&gt;- end the loop entirely, skipping the continue block also&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;redo &lt;/span&gt;- reexecute the code block wthout reevaluating the conditional statement for the loop. It skips the remainder of the code block and also the continue block.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-971225296898756367?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/971225296898756367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=971225296898756367&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/971225296898756367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/971225296898756367'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/basic-12-loop-controls.html' title='Basic #12, loop controls'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-5471834749683639797</id><published>2007-01-03T16:18:00.000+08:00</published><updated>2007-01-03T16:27:32.242+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='for loop'/><title type='text'>Basic #11, for loops</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;LABEL &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;for &lt;/span&gt;(&lt;span style="color: rgb(51, 102, 255);"&gt;EXPR&lt;/span&gt;; &lt;span style="color: rgb(51, 102, 255);"&gt;EXPR; EXPR&lt;/span&gt;) BLOCK&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;e.g. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;for($i=0;$i&lt;100;$i++){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;    .....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;for($i=0, $j=0; $i&lt;100;$i++,$j++){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;    ....&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;LABEL &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;foreach &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;VAR &lt;/span&gt;(&lt;span style="color: rgb(204, 51, 204);"&gt;LIST&lt;/span&gt;) &lt;span style="color: rgb(255, 0, 0);"&gt;BLOCK&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;LABEL &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;foreach &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;VAR &lt;/span&gt;(&lt;span style="color: rgb(204, 51, 204);"&gt;LIST&lt;/span&gt;) &lt;span style="color: rgb(255, 0, 0);"&gt;BLOCK &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;continue &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;BLOCK &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;e.g.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;for (@months){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;    print "&lt;span style="color: rgb(51, 255, 51);"&gt;$_&lt;/span&gt;\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;foreach $key (keys %monthstonum){&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;    print "Month $monthstonum{$key} is $key\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-5471834749683639797?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/5471834749683639797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=5471834749683639797&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5471834749683639797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5471834749683639797'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/basic-11-for-loops.html' title='Basic #11, for loops'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-4735212456909012120</id><published>2007-01-03T16:11:00.000+08:00</published><updated>2007-01-03T16:17:54.610+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='loop'/><category scheme='http://www.blogger.com/atom/ns#' term='do while'/><category scheme='http://www.blogger.com/atom/ns#' term='do'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='continue'/><category scheme='http://www.blogger.com/atom/ns#' term='do until'/><title type='text'>Basic #10, while statements</title><content type='html'>&lt;span style="font-weight: bold; color: rgb(0, 102, 0);font-size:85%;" &gt;while&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);font-size:85%;" &gt;(EXPR)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);font-size:85%;" &gt;while&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-size:85%;" &gt;(EXPR)&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;BLOCK&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;while &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-size:85%;" &gt;(EXPR)&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;BLOCK &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;continue&lt;/span&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt; &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;BLOCK&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;the block after the optional continue statement will be executed after each iteration&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;do &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;BLOCK &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;while &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);font-size:85%;" &gt;(EXPR)&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);font-size:85%;" &gt;do &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;BLOCK &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;until &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;&lt;span style="font-size:85%;"&gt;(EXPR)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-4735212456909012120?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/4735212456909012120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=4735212456909012120&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4735212456909012120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4735212456909012120'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/basic-10-while-statements.html' title='Basic #10, while statements'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-681422330531659072</id><published>2007-01-03T13:43:00.000+08:00</published><updated>2007-01-03T16:02:26.070+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='basic perl'/><category scheme='http://www.blogger.com/atom/ns#' term='if'/><category scheme='http://www.blogger.com/atom/ns#' term='conditional statements'/><title type='text'>Basic #9, If statements</title><content type='html'>&lt;span style="font-size:85%;"&gt;Various ways of executing the if statement&lt;br /&gt;&lt;br /&gt;&lt;statement&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt; if&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr)&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr) &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt; &lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;else &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr) &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;elsif &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr)&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;{block} ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;if&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr) &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt; &lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;elsif &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;(expr)&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;{block} ... &lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;else &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{block}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expression) &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;?&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;(statement if true)&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt; :&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;(statement if false)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;unless &lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;(expr)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/statement&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-681422330531659072?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/681422330531659072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=681422330531659072&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/681422330531659072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/681422330531659072'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/basic-9-if-statements.html' title='Basic #9, If statements'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-8081488397489478629</id><published>2007-01-03T12:24:00.000+08:00</published><updated>2007-01-03T12:30:14.837+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl reserved hashes'/><title type='text'>MISC #3, Reserved Hashes</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;%INC&lt;/span&gt;&lt;br /&gt;     contains the list of files included via do or require. The key is the file u specified, value is the actual location of the imported file&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;%ENV&lt;/span&gt;&lt;br /&gt;    list of operators supplied by the current environment. The key is the name of the env variable, corresponding value is the variable's value. Setting a single variable in the hash changes the environment variable for child processes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;%SIG&lt;/span&gt;&lt;br /&gt;    keys of the %SIG are the signals available on the current machine. The values corresponds to how the signal will be handled.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-8081488397489478629?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/8081488397489478629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=8081488397489478629&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8081488397489478629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8081488397489478629'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/misc-3-reserved-hashes.html' title='MISC #3, Reserved Hashes'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-8978296902235747340</id><published>2007-01-03T12:20:00.000+08:00</published><updated>2007-01-03T12:24:02.860+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl reserved array'/><title type='text'>MISC #2, Reserved Arrays</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;@ARGV&lt;/span&gt;&lt;br /&gt;     list of command line arguments supplied to the script. first index, 0, is the first argument&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;@INC&lt;/span&gt;&lt;br /&gt;    list of directories that Perl should examine when importing modules via the do, require, or use constructs&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;@_&lt;/span&gt;&lt;br /&gt;    list of parameters supplied to the function or subroutine&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-8978296902235747340?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/8978296902235747340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=8978296902235747340&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8978296902235747340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8978296902235747340'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/misc-2-reserved-arrays.html' title='MISC #2, Reserved Arrays'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-7872314678089672739</id><published>2007-01-03T11:13:00.000+08:00</published><updated>2007-01-03T12:19:59.037+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl reserved variables'/><title type='text'>MISC #1, Reserved Variables</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$_, $ARG&lt;/span&gt;&lt;br /&gt;   default input and pattern searching space&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$&lt;digit&gt;&lt;/span&gt;&lt;digits&gt;&lt;br /&gt;  contains the reg expression specified within the parentheses from the last reg expression match&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$&amp;, $MATCH&lt;/span&gt;&lt;br /&gt;  String matched by last successful pattern match&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$', $PREMATCH&lt;/span&gt;&lt;br /&gt;  string preceeding information matched by the last pattern match&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$', $POSTMATCH&lt;/span&gt;&lt;br /&gt;  string following information matched by the last pattern match&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$+, $LAST_PAREN_MATCH&lt;/span&gt;&lt;br /&gt;  last bracket match by the last regular expression search pattern&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$*, $MULTILINE_MATCHING&lt;/span&gt;&lt;br /&gt;  Set to 1 to do multiline pattern matching within a string. default 0&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$., $NR, $INPUT_LINE_NUMBER, input_line_number HANDLE EXPR&lt;/span&gt;&lt;br /&gt;  current input line no. of the last file read, can be either keyboard, ext file or other file handle&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$/, $RS, $INPUT_RECORD_SEPARATOR, input_record_separator HANDLE EXPR&lt;/span&gt;&lt;br /&gt;  current input record separator. newline by default, can be undefined to read in entire file&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$|, $OUTPUT_AUTOFLUSH, autoflush HANDLE EXPR&lt;/span&gt;&lt;br /&gt;  all output is buffered by default, periodically flushed. Value is thus set to 0. If value is non-zero, file handle will be auto-flushed after each write operation&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$, $OFS, $OUTPUT_FIELD_SEPARATOR, output_field_separator HANDLE EXPR&lt;/span&gt;&lt;br /&gt;  default output separator for the print series of functions. default is comma separated&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$\, $ORS, $OUTPUT_RECORD_SEPARATOR, output_record_separator HANDLE EXPR&lt;/span&gt;&lt;br /&gt;  default output record separator. Ordinarily, none&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$", $LIST_SEPARATOR&lt;/span&gt;&lt;br /&gt;  defines the separator inserted between elements of array output within a double-quoted string. Default is single space&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$;, $SUBSEP, $SUBSCRIPT_SEPARATOR&lt;/span&gt;&lt;br /&gt;  separator used when emulating multi-dimensional arrays. default "\034"&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$#, $OFMT&lt;/span&gt;&lt;br /&gt;  default number format to use when printing numbers&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$%, $FORMAT_PAGE_NUMBER&lt;/span&gt;&lt;br /&gt;  page number of current output channel&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$=, $FORMAT_LINES_PER_PAGE&lt;/span&gt;&lt;br /&gt;  no. of printable lines of the current page&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$-, $FORMAT_LINES_LEFT&lt;/span&gt;&lt;br /&gt;  no. of lines available to print on the current page&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$~, $FORMAT_NAME&lt;/span&gt;&lt;br /&gt;   name of the current report format in used by the current output channel. default to name of file handle&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^, $FORMAT_TOP_NAME&lt;/span&gt;&lt;br /&gt;   name of current top-of-page output format for the current output channel. default is the filehandle with _TOP appended&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$:, $FORMAT_LINE_BREAK_CHARACTERS&lt;/span&gt;&lt;br /&gt;   set of characters after which aa string may be broken to fill continuation fields. Default is "\n-"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^L, $FORMAT_FORMFEED&lt;/span&gt;&lt;br /&gt;   character to be used to send a form feed to the output channel. default '\b'&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$ARGV&lt;/span&gt;&lt;br /&gt;   name of current file when reading from the default filehandle &lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^A, $ACCUMULATOR&lt;/span&gt;&lt;br /&gt;   when outputting formatted information via the reporting system, the &lt;span style="font-weight: bold;"&gt;formline&lt;/span&gt; functions put the formatted results into $^A, and the &lt;span style="font-weight: bold;"&gt;write&lt;/span&gt; function then outputs and empties the accumulator variable. This the current value of the &lt;span style="font-weight: bold;"&gt;write&lt;/span&gt; accumulator for &lt;span style="font-weight: bold;"&gt;format&lt;/span&gt; lines.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$?, $CHILD_ERROR&lt;/span&gt;&lt;br /&gt;   status returned by the last external command or last pipe close. This is the value returned by wait, so the true return value is &lt;span style="font-weight: bold;"&gt;$? &gt;&gt; 8&lt;/span&gt;, and &lt;span style="font-weight: bold;"&gt;$? &amp;127&lt;/span&gt; is the number of the signal received by the process, if appropriate&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$!, $ERRNO, $OS_ERROR&lt;/span&gt;&lt;br /&gt;   returns the error number or error string according to the context in which it is used&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$^E, $EXTENDED_OS_ERROR&lt;/span&gt;&lt;br /&gt;   contains extended error info for OSs other than Unix. In unix, $^E = $!&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$@, $EVAL_ERROR&lt;/span&gt;&lt;br /&gt;   error msg returned by the Perl interpreter after executing the &lt;span style="font-weight: bold;"&gt;eval &lt;/span&gt;function. if null, last &lt;span style="font-weight: bold;"&gt;eval &lt;/span&gt;call is successful.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$$, $PID, $PROCESS_ID&lt;/span&gt;&lt;br /&gt;   process no. of Perl Interpreter executing the current script&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$&lt;, $UID, $REAL_USER_ID&lt;/span&gt;&lt;br /&gt; real ID of the user currently executing the interpreter that is executing the script &lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$&gt;, $EUID, $EFFECTIVE_USER_ID&lt;/span&gt;&lt;br /&gt;   effective user id of the current process&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$(, $GID, $REAL_GROUP_ID&lt;/span&gt;&lt;br /&gt;    real group id of current process. If OS supports multi-simultaneous group membership, this returns a space-separated list of group ids&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$), $EGID, $EFFECTIVE_GROUP_ID&lt;/span&gt;&lt;br /&gt;    effective group id of the current process&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$0, $PROGRAM_NAME&lt;/span&gt;&lt;br /&gt;    name of the current file containing the script currently being executed&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$[&lt;/span&gt;&lt;br /&gt;    index of 1st element in array or first character in a substring&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$], $PERL_VERSION&lt;/span&gt;&lt;br /&gt;    version + patchlevel\1000 of the Perl interpreter&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^D, $DEBUGGING&lt;/span&gt;&lt;br /&gt;    value of current debugging flag&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$^F, $SYSTEM_FD_MAX&lt;/span&gt;&lt;br /&gt;    max system file descriptor no. - usually 2. System file descriptors are duplicated across exec'd processes, although higher descriptors are not&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^H&lt;/span&gt;&lt;br /&gt;    status of syntax checks enabled by compiler hints, such as use &lt;span style="font-weight: bold;"&gt;strict&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$^I, $INPLACE_EDIT&lt;/span&gt;&lt;br /&gt;    value of inplace-edit extension (enabled via the -i switch on the cmd line)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^M&lt;/span&gt;&lt;br /&gt;    size of emergency pool reserved for use by Perl and the die function when Perl runs out of memory. The only standard method available for trapping Perl memory overuse during execution&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$^O, $OSNAME&lt;/span&gt;&lt;br /&gt;    operating system name&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^P, $PERLDB&lt;/span&gt;&lt;br /&gt;    interval variable that enables you to specify the debugging value.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;$^R&lt;/span&gt;&lt;br /&gt;    value of last evaluation in a &lt;span style="font-weight: bold;"&gt;(?{ code })&lt;/span&gt; block within a reg expression&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^S&lt;/span&gt;&lt;br /&gt;    current interpreter state. Value is undefined if parsing of the current module is not finished. It is true if inside and evaluation block, otherwise false.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^T, $BASETIME&lt;/span&gt;&lt;br /&gt;    time at which the script starts running, defined as no of seconds since Epoch&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^W, $WARNING&lt;/span&gt;&lt;br /&gt;    current value of the warning switch (specified via the -w cmd line option)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;$^X, $EXECUTABLE_NAME&lt;/span&gt;&lt;br /&gt;    name of the Perl binary being executed, determined via the value of C's argv[0].&lt;br /&gt;&lt;br /&gt;&lt;/digits&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-7872314678089672739?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/7872314678089672739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=7872314678089672739&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7872314678089672739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7872314678089672739'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2007/01/misc-1-reserved-variables.html' title='MISC #1, Reserved Variables'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-3988942650580167478</id><published>2006-12-27T21:21:00.000+08:00</published><updated>2006-12-27T21:40:22.069+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='hash'/><category scheme='http://www.blogger.com/atom/ns#' term='basic perl'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #8, Hashes</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;Hashes are just like arrays, but instead of numbers, hashes use strings as the index.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;Declaration 1:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;%&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;longday = ("sun" =&gt; "sunday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "mon" =&gt; "monday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "tue" =&gt; "tuesday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "wed" =&gt; "wednesday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "thu" =&gt; "thursday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "fri" =&gt; "friday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                      "sat" =&gt; "saturday",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;                     );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;arrays use &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;@&lt;/span&gt;&lt;span style="font-size:85%;"&gt;, while hashes use &lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="font-size:85%;"&gt;%&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-size:85%;"&gt;the left hand side are the keys, the right hand side are the values.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Another way of populating hashes:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0); font-style: italic;font-size:85%;" &gt;%&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;month = ("jan","january","feb","february","mar","march");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;the first character of each pair of strings is the key, while the subsequent is the value.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;We can also create a hash just by creating a pair value:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0); font-style: italic;font-size:85%;" &gt;$&lt;/span&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;font-size:85%;" &gt;dog&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0); font-style: italic;font-size:85%;" &gt;{&lt;/span&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;font-size:85%;" &gt;'jrt'&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0); font-style: italic;font-size:85%;" &gt;}&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;= "Jack Russel Terrier";&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;Accessing a single hash value:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153); font-style: italic;"&gt;print $dog{'jrt'};&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-3988942650580167478?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/3988942650580167478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=3988942650580167478&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/3988942650580167478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/3988942650580167478'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/12/basic-8-hashes.html' title='Basic #8, Hashes'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-8266870529749883397</id><published>2006-11-23T21:18:00.000+08:00</published><updated>2006-11-23T21:38:09.814+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='pop'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='push'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #7, Arrays</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Assignment:  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-style: italic;"&gt;@&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;animals = ('cats','dogs','rabbits');&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="font-weight: bold;"&gt;Retrieval:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$&lt;/span&gt;animals[2]  &lt;/span&gt;&lt;span style="color: rgb(51, 51, 51); font-style: italic;"&gt;-&gt; returns&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;rabbits&lt;br /&gt;&lt;span style="color: rgb(255, 204, 51);"&gt;counting starts from 0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="font-weight: bold;"&gt;Length:&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$sum = @animals;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;print $sum;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;prints 3;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;Last Index:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$#&lt;/span&gt;animals&lt;/span&gt; -&gt; returns 2&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Printing:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;print @animals&lt;/span&gt; -&gt; prints &lt;span style="color: rgb(51, 51, 255);"&gt;catsdogsrabbits&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;print &lt;span style="color: rgb(255, 0, 0);"&gt;"&lt;/span&gt;@animals&lt;span style="color: rgb(255, 0, 0);"&gt;"&lt;/span&gt;&lt;/span&gt; -&gt; prints &lt;span style="color: rgb(51, 51, 255);"&gt;cats dogs rabbits&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Adding:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;push&lt;/span&gt;(@animals, "mouse");&lt;/span&gt; -&gt; adds "mouse" to the list&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$marsupial = 'kangaroo';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;push&lt;/span&gt;(@animals, $marsupial);&lt;/span&gt; -&gt; adds "kangaroo" to the list&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;@predators = ("tigers","leopards");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;push&lt;/span&gt;(@animals, @predators);&lt;/span&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;-&gt; adds "tigers" and "leopards" to the list&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Remove last value:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt; $cute = &lt;span style="color: rgb(255, 0, 0);"&gt;pop&lt;/span&gt;(@animals);&lt;/span&gt; -&gt; remove the last item from the list, and assigns it to $cute&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-8266870529749883397?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/8266870529749883397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=8266870529749883397&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8266870529749883397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8266870529749883397'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-7-arrays.html' title='Basic #7, Arrays'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-5160806181376528413</id><published>2006-11-23T20:57:00.000+08:00</published><updated>2006-11-23T21:00:37.616+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='interpolation'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #7, Interpolation</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;$a = 'apples';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;$b = 'bananas';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102); font-style: italic;"&gt;$a.'  and  '.$b&lt;/span&gt;   prints &lt;span style="color: rgb(0, 102, 0);"&gt;apples and bananas&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;'$a and $b'&lt;/span&gt; prints &lt;span style="color: rgb(0, 102, 0);"&gt;$a and $b&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;"$a and $b"&lt;/span&gt; prints &lt;span style="color: rgb(0, 102, 0);"&gt;apples and bananas&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-5160806181376528413?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/5160806181376528413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=5160806181376528413&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5160806181376528413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5160806181376528413'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-7-interpolation.html' title='Basic #7, Interpolation'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-5762045739827969836</id><published>2006-11-23T20:47:00.000+08:00</published><updated>2006-11-23T21:03:10.593+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='operation'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='concatenation'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><category scheme='http://www.blogger.com/atom/ns#' term='assignment'/><title type='text'>Basic #6, Operations and Assignments</title><content type='html'>&lt;span style="color: rgb(0, 153, 0); font-weight: bold;font-size:85%;" &gt;Numeric Assignments:&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;+&lt;/span&gt;&lt;span style="font-size:85%;"&gt;               add&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;-&lt;/span&gt;&lt;span style="font-size:85%;"&gt;                minus&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;*&lt;/span&gt;&lt;span style="font-size:85%;"&gt;                multiply&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;/&lt;/span&gt;&lt;span style="font-size:85%;"&gt;                divide&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;**&lt;/span&gt;&lt;span style="font-size:85%;"&gt;              power&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;%&lt;/span&gt;&lt;span style="font-size:85%;"&gt;              remainder of&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;$a++&lt;/span&gt;&lt;span style="font-size:85%;"&gt;          returns    value of a, then increment it by 1&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;++$a&lt;/span&gt;&lt;span style="font-size:85%;"&gt;           increment value of a, then return it&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;$a--&lt;/span&gt;&lt;span style="font-size:85%;"&gt;              returns value of a, then decrement it&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;--$a&lt;/span&gt;&lt;span style="font-size:85%;"&gt;           decrements value of a, then return it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);font-size:85%;" &gt;String:&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;$a . $b&lt;/span&gt;&lt;span style="font-size:85%;"&gt;            concatenation&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-size:85%;" &gt;$a x $b&lt;/span&gt;&lt;span style="font-size:85%;"&gt;         a is repeated b times&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-5762045739827969836?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/5762045739827969836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=5762045739827969836&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5762045739827969836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5762045739827969836'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-6-operations-and-assignments.html' title='Basic #6, Operations and Assignments'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-4487556568142699902</id><published>2006-11-23T20:41:00.000+08:00</published><updated>2006-11-23T20:46:49.861+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='variable'/><category scheme='http://www.blogger.com/atom/ns#' term='scalar'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #5, Scalar variables</title><content type='html'>&lt;span style="font-size:85%;"&gt;A variable is  essentially a placeholder for some data, which can be reused many times.&lt;br /&gt;For perl, we do not need to declare what type(int, string)  is the variable.&lt;br /&gt;&lt;br /&gt;variables in perl are just prefixed with a &lt;span style="color: rgb(204, 0, 0);"&gt;$&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;e.g. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$a = 'apple';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$number = 67;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$number = '67';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(102, 102, 102);"&gt;$number = '00067';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;all of the above are valid assignments&lt;br /&gt;&lt;br /&gt;variable names can be combinations of numbers, characters and _.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;$_&lt;/span&gt; is special and reserved, cannot be used.&lt;br /&gt;&lt;br /&gt;Scalar variables are &lt;span style="color: rgb(255, 0, 0);"&gt;case sensitive&lt;/span&gt;, i.e. $a is different from $A.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-4487556568142699902?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/4487556568142699902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=4487556568142699902&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4487556568142699902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4487556568142699902'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-5-scalar-variables.html' title='Basic #5, Scalar variables'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-4577254245056701836</id><published>2006-11-23T20:16:00.000+08:00</published><updated>2006-11-23T20:20:39.661+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pragma'/><category scheme='http://www.blogger.com/atom/ns#' term='use strict'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #4, the strict pragma</title><content type='html'>&lt;p&gt;&lt;span style="font-size:85%;"&gt;A &lt;span style="color: rgb(255, 0, 0);"&gt;pragma &lt;/span&gt;is a special perl module that hints the compiler the way a block of statements should be compiled. If the program disobeys the restrictions placed on it, it won’t compile. Here is an example:&lt;/span&gt;&lt;/p&gt;      &lt;p style="font-style: italic; color: rgb(102, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;———————————————&lt;br /&gt;#!C:/Perl/Bin/Perl&lt;br /&gt;use strict “subs”;&lt;br /&gt;$name = Ellie;&lt;br /&gt;print “Hi $name”;&lt;br /&gt;———————————————-&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;2nd Line&lt;/span&gt;&lt;br /&gt;The 2nd line tells the compiler to use the module - strict, with &lt;span style="color: rgb(255, 153, 0);"&gt;subs &lt;/span&gt;as the argument.&lt;br /&gt;The existence of this 2nd line will give the following outcome:&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(102, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;Bareword “Ellie” not allowed while “strict subs” in use at try_pragma.pl line 3.&lt;br /&gt;Execution of try_pragma.pl aborted due to compilation errors.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;The use function call allows users to use modules located in the standard Perl library, which is located at &lt;span style="color: rgb(255, 153, 0);"&gt;C:\Perl\lib&lt;/span&gt; in windows.&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 0, 153);"&gt;&lt;span style="font-size:85%;"&gt;When the strict pragma takes “subs” as an argument, it will capture any bare words, or unquoted strings, when the script is being compiled. The program will abort with an error message.&lt;/span&gt; &lt;/p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-4577254245056701836?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/4577254245056701836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=4577254245056701836&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4577254245056701836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/4577254245056701836'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-4-strict-pragma.html' title='Basic #4, the strict pragma'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-7696583989376409879</id><published>2006-11-23T20:05:00.000+08:00</published><updated>2006-11-23T20:09:36.542+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='literals'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #3, Literals</title><content type='html'>&lt;p style="color: rgb(51, 51, 255);"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Numeric Literals&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;table style="color: rgb(51, 51, 255); width: 291px; height: 102px;"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;12345&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Integer&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;0×456ff&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Hexadecimal&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;0777&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Octal Numbers&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;23.45&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Float&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="font-style: italic;"&gt;&lt;span style="font-size:85%;"&gt;.234E-2&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Scientific Notation&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p style="color: rgb(0, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;String Literals&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;table style="color: rgb(0, 102, 0);"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\t&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Tab&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\n&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;New Line&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\r&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Carriage Return&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\f&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Form Feed&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\b&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Backspace&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\a&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Alarm/Bell&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\e&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;escape&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;33&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Octal Character&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\xff&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Hexadecimal Character&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\c[&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Control Character&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\l&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Next character is converted to lower case&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\u&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Next character is converted to upper case&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\L&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Next characters are converted to lower case until a \E is found&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\U&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Next characters are converted to upper case until a \E is found&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\Q&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Backslash all following non-alphanumeric characters until a \E is found&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\E&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Ends upper or lower case conversion started with \L or \U&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;\\&lt;/span&gt;&lt;/td&gt; &lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;Backslash&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;p style="color: rgb(102, 51, 102);"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Special Literals&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table style="color: rgb(102, 51, 102); width: 557px; height: 68px;"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;_LINE_&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Represents the current line number&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;_FILE_&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Represents the current filename&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;_END_&lt;/span&gt;&lt;/td&gt; &lt;td&gt;&lt;span style="font-size:85%;"&gt;Represents the logical end of script; trailing garbage is ignored&lt;/span&gt;&lt;/td&gt;&lt;td style="vertical-align: top;"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-7696583989376409879?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/7696583989376409879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=7696583989376409879&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7696583989376409879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/7696583989376409879'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-3-literals.html' title='Basic #3, Literals'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-8155044837838283037</id><published>2006-11-23T19:33:00.000+08:00</published><updated>2006-11-23T20:02:42.671+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='switches'/><title type='text'>Basic #2, Switches to Run Perl</title><content type='html'>&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;-e Switch&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;Executes perl statements at command prompt instead of from a script file.&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;e.g perl -e “print ‘hello dolly’”;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;-c Switch&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:85%;"&gt;Checks the syntax of the perl script without actually executing the Perl commands. If the syntax is correct, Perl will tell you so.&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;e.g. perl -c hello.pl&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-style: italic; color: rgb(153, 153, 153);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;The -w Switch&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size:85%;"&gt;Warns user about possibility of using future reserved words.&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153);"&gt;e.g    try_w_switch.pl&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(153, 153, 153);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;#!C:/Perl/Bin/Perl&lt;br /&gt;print STDOUT ellie, “\tThe price is \$100.00\n”;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 102, 0);"&gt;&lt;span style="font-size:85%;"&gt;If i run it just using perl try_w_switch.pl, the output is :&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(153, 153, 153);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;ellie     The price is $100.00&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;However, if i run it using perl -w try_w_switch.pl, i get the following output:&lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(153, 153, 153);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;Unquoted string “ellie” may clash with future reserved word at try_w_switch.pl line 2.&lt;br /&gt;ellie     The price is $100.00&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 153, 0);"&gt;&lt;span style="font-size:85%;"&gt;Btw, the &lt;em&gt;print STDOUT ….&lt;/em&gt; is just another way to print text to the standard output, only with this type of command can i use the comma sign.&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 0, 153);"&gt;&lt;span style="font-size:85%;"&gt;A “\t” indicates a tab character.&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 0, 153);"&gt;&lt;span style="font-size:85%;"&gt;A “\n” indicates a new line character.&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(0, 0, 153);"&gt;&lt;span style="font-size:85%;"&gt;A “\” is neccessary before the “$” sign, else the output will be incorrect. This is because the “$”,”@” and “%” signs are special character prefix for variables. &lt;/span&gt;&lt;/p&gt;&lt;span style="color: rgb(0, 0, 153);font-size:85%;" &gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-8155044837838283037?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/8155044837838283037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=8155044837838283037&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8155044837838283037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/8155044837838283037'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/e-switch-executes-perl-statements-at.html' title='Basic #2, Switches to Run Perl'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-211134735146872029.post-5729066628149241496</id><published>2006-11-23T19:22:00.000+08:00</published><updated>2006-11-23T20:03:45.306+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hello world'/><category scheme='http://www.blogger.com/atom/ns#' term='perl tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><category scheme='http://www.blogger.com/atom/ns#' term='learn perl'/><title type='text'>Basic #1 Hello World</title><content type='html'>&lt;p&gt;&lt;span style="font-size:85%;"&gt;This is the first perl script to write.&lt;/span&gt;&lt;/p&gt;     &lt;p&gt;&lt;span style="font-size:85%;"&gt;--------------------------------------------------------------------------------------&lt;br /&gt;#!C:/Perl/Bin/Perl&lt;br /&gt;#prints the words “hello world” with a leading next-line character&lt;br /&gt;print “Hello World\n”;&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Line 1&lt;/span&gt;&lt;br /&gt;The first line &lt;strong&gt;must&lt;/strong&gt; always start with the “shebang” character -”#!”, followed by the location of where your perl interpreter resides.&lt;/span&gt; &lt;p style="color: rgb(153, 153, 153);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;I am using windows, but i suggest to use the “/” instead of the “\” as the folder separator because next time if you write a perl script on the apache server, all the “\” folder separator must be changed to “/” for it to work propely.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;"&gt;Line 2&lt;/span&gt;&lt;br /&gt;The second line uses the &lt;em&gt;print&lt;/em&gt; command to print the trailing text unto the standard output.&lt;/span&gt;&lt;/p&gt; &lt;p style="color: rgb(153, 153, 153);"&gt;&lt;span style="font-size:85%;"&gt;&lt;em&gt;Note that except for the first line, all lines should end with a “;” to indicate the end of the line.&lt;/em&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);"&gt;Line 3&lt;/span&gt;&lt;br /&gt;The 3rd line is a comment, it will not be executed. A comment is indicated by a “#” at the beginning.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;Save the file as &lt;em&gt;hello.pl&lt;/em&gt; and run perl hello.pl in the command prompt.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://i112.photobucket.com/albums/n196/practicalperl/helloworld.jpg" alt="hello world" height="226" width="450" /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;That’s it! &lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/211134735146872029-5729066628149241496?l=practical-perl.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://practical-perl.blogspot.com/feeds/5729066628149241496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=211134735146872029&amp;postID=5729066628149241496&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5729066628149241496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/211134735146872029/posts/default/5729066628149241496'/><link rel='alternate' type='text/html' href='http://practical-perl.blogspot.com/2006/11/basic-1-hello-world.html' title='Basic #1 Hello World'/><author><name>takeuaway</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
