Фрагменты Perl 6 в Perl 5.10

Document Sample
Фрагменты Perl 6 в Perl 5.10 Powered By Docstoc
					Фрагменты Perl 6
   в Perl 5.10
Фрагменты Perl 6
   в Perl 5.10
  и различия
use
feature
qw(




say




switch




state
);
use
feature
qw(




say




switch




state
);

use
feature
":5.10";
use
feature
qw(




say




switch




state
);

use
feature
":5.10";
use
5.10.0;
use
feature
qw(




say




switch




state
);

use
feature
":5.10";
use
v5.10.0;
say
my
$x
=
‘UPW2008’;
say
$x;
                     5.10
my
$x
=
‘UPW2008’;
say
$x;

UPW2008
                     6
my
$x
=
‘UPW2008’;
say
$x;

UPW2008
                     5.10
my
$x
=
‘UPW2008’;
say
($x);
                     5.10
my
$x
=
‘UPW2008’;
say
($x);

UPW2008
                     6
my
$x
=
‘UPW2008’;
say
($x);

UPW2008
                     6
my
$x
=
‘UPW2008’;
say($x);

UPW2008
                     6
my
$x
=
‘UPW2008’;
$x.say;

UPW2008
                     5.10
my
$x
=
‘UPW2008’;
$x.say;
                     6
my
$x
=
‘UPW2008’;
$x.say();

UPW2008
                   5.10
my
$x
=
‘UPW2008’;
$x.say();
Undefined
subroutine

&main::say
called
at
‐e

line
1
for
(1..3)
{




say;
}
               5.10
for
(1..3)
{




say;
}
1
2
3
               6
for
(1..3)
{




say;
}
\n
\n
\n
               6
for
(1..3)
{




say
$_;
}
1
2
3
               6
for
(1..3)
{




$_.say;
}
1
2
3
               6
for
(1..3)
{




.say;
}
1
2
3
switch
                   5.10, 6
my
$str
=
"YAPC::Asia";

given
($str)
{




when
(/Asia/)
{








say
"Asia"




}
}
                   5.10, 6
my
$str
=
"YAPC::Asia";

given
($str)
{




when
(/Asia/)
{








say
"Asia"




}
}
                           6
my
$str
=
"YAPC::Asia";

given
($str)
{




when
(/Asia/)
{








say
"Asia"




}
}
                           6
my
$str
=
"YAPC::Asia";

given
$str
{




when
/Asia/
{








say
"Asia"




}
}
                         6
my
$str
=
"YAPC::Asia";

given
$str
{




say
"Asia"
when
/Asia/

}
state
sub
f
{



state
$c;



say
++$c;
}
sub
f
{



state
$c;



say
++$c;
}
f();
f();
f();
                 5.10
sub
f
{



state
$c;



say
++$c;
}
f();
f();
f();
1
2
3
                 6
sub
f
{



state
$c;



say
++$c;
}
f();
f();
f();
1
2
3
sub
f
{



state
$c
=
0;



say
++$c;
}
f();
f();
f();
                   5.10
sub
f
{



state
$c
=
0;



say
++$c;
}
f();
f();
f();
1
2
3
                   pugs
sub
f
{



state
$c
=
0;



say
++$c;
}
f();
f();
f();
1
1
1
//
   //

defined‐or
my
$c
=
0;
my
$d
=
$c
//
3;
say
$d;










0

my
$e
=
0;
my
$f
=
$e
||
4;
say
$f;










4
~~

				
DOCUMENT INFO
Shared By:
Stats:
views:4
posted:5/1/2010
language:Russian
pages:42