The tutor continues with some explanation of last post’s Perl random walk simulation. Below is the Perl code from last post, this time with some comments (recall that # denotes a comment in Perl): #!/usr/bin/perl # needed for Linux (Unix) …

Perl random walk simulation: code explanation Read more »

The tutor continues about command-line math. Back on April 6 I showed how to use awk to do calculations on the command line. From my understanding, awk is native to Linux, but not Windows. If you’ve got Perl installed on …

Perl: a command-line script Read more »

The tutor explains a few details about yesterday’s program. The program, with the while loop and its support code added in orange, is as follows: #!/usr/bin/perl %maritimecapitals=(‘NB’,’Fredericton’,’NS’,’Halifax’,’PEI’,’Charlottetown’); $prov = ‘Y’; while($prov ne ‘X’ && $prov ne ‘x’){ print “Hello. Which …

Perl: some explanation of yesterday’s while loop Read more »

The tutor returns to the perl sort function. Back in my post on November 27 I introduced a perl program that finds the median of a list of numbers. It depends on perl’s built-in sort function to put the numbers …

Perl: alphabetizing a list of command line arguments Read more »

The tutor follows up on an issue that evolved with the ASCII bell character, ‘\a’, a few posts ago. Back on January 29 I introduced a Perl program that takes, as input, a waiting time in seconds, then makes three …

Perl: sleep() and the bell, part II Read more »