Term
|
Definition
|
|
Term
what is the binding operator |
|
Definition
|
|
Term
what does the binding operator mean |
|
Definition
apply the operation on the right to the string on the left |
|
|
Term
|
Definition
variable that stores multiple scalars |
|
|
Term
|
Definition
|
|
Term
test for numerical equality |
|
Definition
|
|
Term
what should you always do with systems calls |
|
Definition
check for failure e.g. when trying to open a file, always check that the filename exists using unless loop |
|
|
Term
what does this mean /^\s*$/ |
|
Definition
regular expression // ^ from the beginning of the string \s : whitespace, tab, newline, formfeed * is zero or more times there $ to the end of the string |
|
|
Term
|
Definition
$& the string matched by the last successful pattern match |
|
|
Term
|
Definition
$sequence =~ /$motif/ **This returns a boolean** the result is given by $& |
|
|
Term
|
Definition
$A = ($sequence =~ tr/Aa//); |
|
|
Term
count A's in sequence using a while loop |
|
Definition
while ($sequence =~ /a/ig) { $A++; } ** i means case insensitive ++ g means global - i.e. stop when you get to end of sequence |
|
|
Term
|
Definition
within a subroutine the array @_ contains the parameters that were passed to the subroutine |
|
|
Term
naming your arguments in a subroutin |
|
Definition
my($dna, $protein, $gene_name) = @_; |
|
|
Term
|
Definition
is the name of the program in question |
|
|
Term
# read in the DNA from the command line |
|
Definition
|
|
Term
|
Definition
contains the command line arguments intended for the script |
|
|
Term
|
Definition
first argument from command line arguments NOT the programs name |
|
|
Term
subroutine with multiple arguments |
|
Definition
sub routine() { my($scalar, $array, $hash) = @_; $$scalar++; join(@$array); join(%$hash); return blah; } ** NB changes to arguments in subroutine are carried into main routine |
|
|
Term
|
Definition
routine(\$scalar, \@array, \%hash); |
|
|
Term
|
Definition
@LIST = grep(EXPRESSION, @ARRAY);
Perl's grep() function runs a regular expression on each element of an array, and returns only the elements that evaluate to true.
@myNames = ('Jacob', 'Michael', 'Joshua', 'Matthew', 'Alexander', 'Andrew'); @grepNames = grep(!/^A/, @myNames);
In the above example, the regular expression is looking for any value that does not start with a capital A. After sifting through the contents of the @myNames array, the value of @grepNames becomes ('Jacob', 'Michael', 'Joshua', 'Matthew'). |
|
|
Term
|
Definition
$ice="cold"; $length_ice = length ($ice); |
|
|
Term
|
Definition
$portion = substr($string_variable, start number, length); |
|
|
Term
three things to remember about modules |
|
Definition
1. suffix is .pm 2. when they are CALLED the suffix is not used: use BegPerlBioinformatics 3. the last line in the module must be 1; |
|
|
Term
|
Definition
my @array = ('a','b','c'); |
|
|
Term
seed a random number generator |
|
Definition
|
|
Term
|
Definition
|
|
Term
give the number of elements in an array |
|
Definition
|
|
Term
remove the fractional part of the number $number |
|
Definition
|
|
Term
return a random number greater than 0 and less than $number |
|
Definition
|
|
Term
|
Definition
|
|
Term
a popular way to pick a perl seed |
|
Definition
time|$$ (combining the time and the ID of the perl programme that is currently running |
|
|
Term
|
Definition
|
|
Term
specific element if an array |
|
Definition
|
|
Term
code for random element in an array |
|
Definition
$array[int rand scalar @array] |
|
|
Term
really fast code for random element in an array |
|
Definition
|
|
Term
what do you need to remember before calling rand |
|
Definition
|
|
Term
random position in a string |
|
Definition
int(rand(length($string))) which is the same as int rand length $string |
|
|
Term
in a string replace char at position $position with $newchar |
|
Definition
substr($string, $position, 1, $newchar); |
|
|
Term
initialise an empty array |
|
Definition
|
|
Term
what does the push function do |
|
Definition
Perl's push() function is used to push a value or values onto the end of an array, which increases the number of elements. The new values then become the last elements in the array. push(@array,$string) |
|
|
Term
turn a decimal into a percent |
|
Definition
|
|
Term
how to select all combinations of two elements from a set: |
|
Definition
Nested loop: for (my $i=0; $i<10; $i++) { for (my $j = $i+1; $j<10; $j++) { } } |
|
|