Perl
In this section are demonstrations to programs written in the high level programming language of Pearl.
How to install Pearl runtime and run pearl programs in the command line.
Step 0: Test if perl is installed
Alternatively, open a command prompt window (press Win⊞ + R, type cmd, and hit Enter) and enter the command: perl -v -version. This will output the version of Perl installed on your computer. If the command is not recognized then you will need to install the Strawberry Perl
Step 1: Install Strawberry Perl
Step 2: Find path to your Perl installation folder which can be found through
In order to test it go to command prompt and type perl -v
In order make sure whether compiler is setup Type in cmd
To run a program
go to the directory where the program is installed:
cd
Then type in:
file.pl
How to compile & run a pearl application
Programs
NCBI Statistical Generator
This program opens a file containing nucleotide IDs for inserting into a query for the nucleotide database of NCBI. The program collects statistical data on the mean, minimum & maximum range of the sequence lengths and stores where present protein IDs. The protein IDs are then used to retrieve the amino acid sequence from the protein database of the NCBI and is interrogated to calculate the percentage of occurrences of the amino acid cysteine. The results of the query are printed to the screen and provide the user information on the statistics are recalculated for this remaining data set. The option is the given to the user to save the resulting contents of the search in a file which can be viewed for easier referencing.
Spieces Counter by Country
This program counts the number of collections made of various spieces in a particular country. A random sample data set was retrieved using the API defined by the Bold System Taxonomy API to populate two database tables one listing countries and the other the spieces colleciton sites.
The program begins by requesting the user for keyboard input. The user has a choice of entering their own database connection parameters or accepting the defaults by pressing enter on each request for information. The user is then prompted for the country they wish to query the database for by typing in the country's name. The program will then process the query and return either the search results or alternatively a warning will be displayed that the query has not returned any results. Subsequently, regardless of what is returned by the program, the program will request the user to select whether they wish to cancel the program or conduct another search. The program will then verify the user input to see if they typed 'YES' or 'Y' in a non-case sensitive form, otherwise any other response will result in exiting the program.
Snap
How to play
THE PACK - The standard 20x4-card pack is used.
OBJECT OF THE GAME - The goal is to win all of the cards
THE DEAL
Deal out all cards face down, one at a time, beginning to the dealer’s left. It does not matter if some players have more cards than others. Each player puts their cards in a pile, face down in front of them.
THE PLAY
The player on the dealer’s left turns over the top card of his pile and puts it face up starting a pile of cards next to their face down cards. The next player to the left does the same and so on around the table.
When someone turns up a card that matches a card already face up on another player’s pile, the first person to notice the two matched cards calls out “Snap!” and wins both piles. This player adds the cards to the bottom of their face-down pile. During the game, if a player runs out of cards in their face-down pile, the cards in the face up pile are turned down and the player continues to play.
An example of a Snap game between a player and another player (Shown at 2x regular speed)
Players each assign themselves each a key and then compete against each other to win the round.
An example of a Snap game between a player and the computer (Shown at 2x regular speed)
The computer gives the player two seconds to respond and if they do not the AI wins the round.