Heikki Perl-Bioperl
Heikki Perl-Bioperl
Downloadable at
http://www.perl.org/books/beginning-perl/
and locally
comments
Concatenation . N/A
Repetition x N/A
shift() push()
0 1 2 3 4
unshift() pop()
unless ($valid) {
check($value)
}
transposition helps check($value) unless $valid;
readability
hashes of hashes,
hashes of arrays, ...
ref() tells what is the referenced
structure
# same as:
> perl -ne '#do something'
# redirection
local $/ = "\/\/\n";
read file one EMBL seq open my $SEQ, '<', shift
entry at a time or die $!;
while (<$SEQ>) {
my $seq = $_;
modify $/ in a closure my ($ac) =
or subroutine $seq =~ /AC +(\w+)/;
print "$ac\n"
only use for local you'll see! if $seq =~ /FT +CDS/;
}
}
/./ # any
Greedy by default
/.+(w+)/; # last word character
“always match all you can” /.+?(w+)/; # first whole word
$ sudo cpan
cpan> install YAML
...
Test
perl -MBio::Perl -le 'print Bio::Perl->VERSION;'
% perl ex2.pl
seq length is 13
translation is MGPS