Теор. лингвистика на ВТ, 20 сен

Дз: в методичке "теория управления и связывания" (оранжевая) с2-5 читать 
в файле "perl basics" (на англ) читать до выделенного на 2й странице слова "loops"(текст под катом)
по возможности установить домой ОС линукс и Perl под него


 что под катом: часть файла "перл басикс", линукс и перл под линукс и винду


 ИЗ ФАЙЛА "PERL BASICS" (то, что нужно прочитать)


    The \n indicates the ``newline'' character.
    The print function itakes a list of things to output as its parameters.            
print "Look, ", "a ", "list!";
    A Perl program consists of statements, each of which ends with a semicolon.
    There are two basic data types in Perl: numbers and strings. A string is a collection of characters in either single or double quotes. Single quotes mean that their contents should be taken literally, while double quotes mean that their contents should be interpreted.   
    Perl has three types of variables: scalars, arrays and hashes. All variable names are a punctuation character, a letter or underscore, and one or more alphanumeric characters or underscores. Scalars are single things. This might be a number or a string. The name of a scalar begins with a dollar sign, such as $i or $abacus. You assign a value to a scalar by telling Perl what it equals, like so:            
$i = 5;      
$pie_flavor = 'apple';
    If you use a double-quoted string, Perl will insert the value of any scalar variables you name in the string. This is often used to fill in strings on the fly:
   $apple_count = 6;
   $count_report = "There are $apple_count apples.";
   print "The report is: $count_report\n";
    Numbers in Perl can be manipulated with the usual mathematical operations: addition, multiplication, division and subtraction.
   $a = 5;
   $b = $a + 10;       # $b is now equal to 15.
   $c = $b * 10;       # $c is now equal to 150.
   $a = $a - 1;        # $a is now 4, and algebra teachers are cringing.
You can also use special operators like ++, --, +=, -=, /= and *=. These manipulate a scalar's value without needing two elements in an equation.
  $a = 5;
  $a++;        # $a is now 6; we added 1 to it.
  $a += 10;    # Now it's 16; we added 10.
  $a /= 2;     # And divided it by 2, so it's 8.
    About the only basic operator that you can use on strings is concatenation, which is a $10 way of saying ``put together.'' The concatenation operator is the period:       $a = "8";    $c = $a . "1";
    Arrays are lists of scalars. Array names begin with @. You define arrays by listing their contents in parentheses, separated by commas:
   @months = ("July", "August", "September");
    The contents of an array are indexed beginning with 0. To retrieve the elements of an array, you replace the @ sign with a $ sign, and follow that with the index position of the element you want.
   @months = ("July", "August", "September");
   print $months[0];   # This prints "July".
   $months[2] = "Smarch";  # We just renamed September!
   $winter_months[0] = "December";  # This implicitly creates @winter_months.
    If you want to find the length of an array, use the value $#array_name. This is one less than the number of elements in the array. If you want to resize an array, just change the value of $#array_name.
   @months = ("July", "August", "September");
   print $#months;         # This prints 2.
   $a1 = $#autumn_months;  # We don't have an @autumn_months, so this is -1.
   $#months = 0;           # Now @months only contains "July".
    Hashes are called ``dictionaries'' in some programming languages, and that's what they are: a term and a definition, or in more correct language a key and a value. Each key in a hash has one and only one corresponding value. The name of a hash begins with a percentage sign, like %parents. You define hashes by comma-separated pairs of key and value, like so:
   %days_in_month = ( "July" => 31, "August" => 31, "September" => 30 );
    You can fetch any value from a hash by referring to $hashname{key}, or modify it in place just like any other scalar.
   print $days_in_month{"September"}; # 30, of course.
   $days_in_month{"February"} = 29;   # It's a leap year.
    If you want to see what keys are in a hash, you can use the keys function with the name of the hash. This returns a list containing all of the keys in the hash. The list isn't always in the same order, though; while we could count on @months to always return July, August, September in that order, keys %days_in_month might return them in any order whatsoever.
   @month_list = keys %days_in_month;
   # @month_list is now ('July', 'September', 'August') !
    The three types of variables have three separate namespaces. That means that $abacus and @abacus are two different variables, and $abacus[0] (the first element of @abacus) is not the same as $abacus{0} (the value in abacus that has the key 0).


LINUX

 Скажу сразу, что я в этом совершенно ничего не понимаю.
Я попыталась поискать линукс, в котором можно работать, не выходя из виндоус (как у нас в классе было), и наткнулась на такую версию. Опробовать ее я не могу, т.к. под мой комп оно не установится (у меня 64 битный)
Можно не устанавливать линукс (как я и сделаю), а просто установить перл под знакомую винду.
 ради прикола можно пройти тест на определение какой линукс вам подойдет больше всего

PERL

Установить можно отсюда. Все инструкции там же


Categories:

Leave a Reply