Mastering Perl for Bioinformatics [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Mastering Perl for Bioinformatics [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










A.11 Basic Operators


For more information on how operators work, consult the
perlop
documentation bundled with Perl.


A.11.1 Arithmetic Operators


Perl has the basic five
arithmetic operators:

+



Addition


-



Subtraction


*



Multiplication


/



Division


**



Exponentiation



These operators work on both integers and floating-point values (and
if you're not careful, strings as well).

Perl also has a modulus operator, which computes
the remainder of two integers:

% modulus

For example, 17 % 3 is 2, because 2 is left over
when you divide 3 into 17.

Perl also has autoincrement and
autodecrement operators:

++ add one
-- subtract one

Unlike the previous six operators, these change a
variable's value. $x++ adds one
to $x, changing 4 to 5 (or a to b).


A.11.2 Bitwise Operators


All
scalars, whether numbers or strings,
are represented as sequences of individual bits
"under the hood." Every once in a
while, you need to manipulate those bits, and Perl provides five
operators to help:

&



Bitwise and


|



Bitwise or


^



Bitwise xor


>>



Right shift


<<



Left shift




A.11.3 String Operators


Two strings
may be concatenated, i.e., joined end to end, with the dot operator:

'This is a ' . 'joined string'

This results in the value 'This
is a joined
string'.

A string may be repeated with the x operator:

print "Hear ye! " x 3;

This prints:

Hear ye! Hear ye! Hear ye!


A.11.4 File Test Operators


File test operators are unary operators that
test files for certain characteristics, such as -e
$file
, which returns true if the file
$file exists. Table A-2 lists
some available file test operators.

Table A-2. File test operators


Operator


Meaning


-r


File is readable


-w


File is writable


-x


File is executable


-o


File is owned by "you"


-e


File exists


-z


File has zero size in bytes


-s


File has nonzero size (returns size in bytes)


-f


File is a plain file


-d


File is a directory (a.k.a. folder)


-l


File is a symbolic link


-t


Filehandle is opened to a terminal


-T


File is a text file


-B


File is a binary file


-M


Age of file (at startup of program) in days since modification


-A


Age of file (at startup of program) in days since last access


-C


Age of file (at startup of program) in days since last inode change


/ 156