:


  ()      .
        
  ().    , , 
 0  null.



   .     '#' 
   .
          
 (statements)       
.          .
     
      .

:
	sub test;	#   test

	$var1 = test $0; #    .

       
 require      
   use.  .  .




  
  ';'      
   ';'  .    
  eval{}  do{}     
          
.

     single 
 ';'.   single :

	if EXPR
	unless EXPR
	while EXPR
	until EXPR

 EXPR -     true  false.
 while  until       do   .

if EXPR		-  "".    EXPR  true.

:
	$var = 1;
	$var2 = 3 if $var > 0; # : $var2 = 3

while EXPR	-  "".      EXPR = true

:
	$var = 1;
	print $var++ while $var < 5; #  $var  

: 1234


until EXPR	-  " ".        EXPR = false

:
	$var = 1;
	print $var++ until $var > 5; #  $var  

: 12345

unless EXPR	-  " " .   if.    EXPR = false.

:
	$var = 1;
	print $var++ unless $var > 5; #  $var  

: 1




    
  .     
 ,     eval{} 
       
 '{}'.

    :

	if (EXPR) BLOCK
	if (EXPR) BLOCK else BLOCK
	if (EXPR) BLOCK elsif (EXPR) BLOCK ... else BLOCK

	LABEL while (EXPR) BLOCK
	LABEL while (EXPR) BLOCK continue BLOCK
	LABEL for (EXPR; EXPR; EXPR) BLOCK
	LABEL foreach VAR (LIST) BLOCK
	LABEL BLOCK continue BLOCK

 ,       
      C  Pascal.  
      .

if (EXPR) BLOCK		-    EXPR   true   .

:
	$var =1;
	if ($var == 1)
	   { print $var,"\n";
	   }
: 1


if (EXPR) BLOCK else BLOCK2	-   EXPR=true  BLOCK  BLOCK2.

:
	$var =2;
	if ($var == 1)
	   { print "\$var = 1\n";
	   }
	else
	   { print "\$var   1\n";
	   }

: $var   1

if (EXPR1) BLOCK1 elsif (EXPR2) BLOCK2 ... else BLOCK	-
	 EXPR1=true  BLOCK1   EXPR2=true 
	BLOCK2  ...  BLOCK.

:
	$var = 1;
	if ($var == 0)
	   { print "\$var = 0\n";
	   }
	elsif ($var == 1)
	   { print "\$var = 1\n";
	   }
	else
	   { print "  \$var\n";
	   }

: $var = 1

 while  BLOCK     EXPR = true.  LABEL 
       ':'.
       
 next, last  redo.      
      .
  continue      
  EXPR.   EXPR3   for
          
   next.



next	-  continue  .     
	..  .

:
	M1:
	while ($i < 6)
	    {
	    ++$i;	#    1
	    next M1 if $i < 3; #     $i < 3
	    ++$i;	#       1
	    }
	continue
	    {
	    print "$i "; #  $i
	    }

: 1 2 4 6

last	-   break   .   .
	 continue .

:
        M1:
        while ($i < 6)
            {
            ++$i;       #    1
            last M1 if $i > 3; #     $i > 3
            ++$i;       #       1
            }
continue {
            print "$i "; #  $i
}

: 2 4

redo	-      EXPR    continue .

:
        M1:
        while ($i < 6)
            {
            ++$i;       #    1
            redo M1 if $i == 3; #    $i = 3
            ++$i;       #       1
            }
continue {
            print "$i "; #  $i
}

: 2 5 7




	LABEL for (EXPR1; EXPR2; EXPR3) BLOCK
 for    for  .   
  EXPR1,  EXPR2 = true  , 
 EXPR3.

:
	for ($i = 2; $i < 5; ++$i)
           {
           print $i, " ";
           }
        print "\n  i = $i\n";

:
	2 3 4
	  i = 5



	LABEL foreach VAR (LIST) BLOCK

 VAR      LIST
  .  VAR    
  $_.       VAR
       .. VAR 
    .
  foreach    for -   .

:
        @ = ("","","");  #  
        foreach $i (@)
            {
            print $i," ";       #  $i
            }

:   

:
        @ = ("","","");  #  
        foreach $i (@)
            {
            $i = uc($i); #    
            }
        print @;

: 

:

	for $i (3,5,7)
	    {
	    print "$i ";
	    }
: 3 5 7




          
      . 
   next, last, redo -  
.     switch () .
     switch    
       .  
       
  if ... elsif ... else ...   
  :

	SWITCH:
	{
	if ($i ==1 ) { .....; last SWITCH; }
	if ($i ==2 ) { .....; last SWITCH; }
	if ($i ==3 ) { .....; last SWITCH; }
	$default = 13;
	}

    .




    goto   ,     
    "  ".
      ""   
 ""   .   
      
  ""    goto .

     goto. goto - , goto - 
 goto - .

goto -       .

goto -  -       .
	          
	"M1:", "M2:"  "M3:"     
	$i  0, 1  2      :

	goto ("M1", "M2", "M3")[$i];

	 $i      
	 .

goto  -    ..    
  "" .



        
   .     POD .
       
  '=' :

	= head   

     '=cut'.    
      . 
    pod   
   .

Last-modified: Thu, 24 Apr 1997 18:07:56 GMT
: