SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
~~
$a
~~
$b
   ==
$b
~~
$a
my
$b;




$b
~~
undef

!defined
$b
my
$c
=
'abc';




$c
~~
'abc'

$c
eq
'abc'
my
$c
=
'abc';




$c
~~
/b/

$c
=~
/b/
my
@a
=
(1..3);
my
@b
=
(1..3);



@a
~~
@b

1
==
1
&&
2
==
2
&&
3
==
3
my
@a
=
(1..3);
my
@b
=
(1..3);
my
@c
=
(3..5);

@a
~~
@c

1
==
3
&&
2
==
4
&&
3
==
5
my
@d
=
(123,
'abc');
my
@e
=
(qr/d/,
qr/w/);



@d
~~
@e

123
~~
/d/
&&
'abc'
~~
/w/
my
@f
=
('a'..'f');




@f
~~
'd'

grep
{$_
eq
'd'}
@f
my
@g
=
(1..10);




@g
~~
7

grep
{$_
==
7}
@g
my
@g
=
(1..10);




@g
~~
7.0

grep
{$_
==
7.0}
@g
my
@g
=
(1..10);




@g
~~
'7.0'

grep
{$_
eq
'7.0'}
@g
my
@g
=
(1..10);




@g
~~
/^d$/

grep
{$_
=~
/^d$/}
@g
3.14
~~
'3.14'

3.14
==
'3.14'
3.14
~~
'3.14%'

3.14
==
'3.14%'
sub
subA
{return
2}
sub
subB
{return
2}



subA
~~
subB

subA()
==
subB()
sub
subA
{return
2}
my
$subA1_ref
=
&subA;
my
$subA2_ref
=
&subA;

$subA1_ref
~~
$subA2_ref

$subA1_ref
==
$subA2_ref
sub
subA
{return
2}
my
$subA_ref
=
&subA;



$a
~~
$subA_ref

$subA_ref‐>($a)
sub
subA
{return
2}
my
$subA_ref
=
&subA;



‐1
~~
$subA_ref

$subA_ref‐>(‐1)
my
%h
=
(a
=>
'alpha',









b
=>
'beta');



%h
~~
'a'

exists
$h{'a'}
my
%h
=
(a
=>
'alpha',









b
=>
'beta');
my
@f
=
('a'..'f');

%h
~~
@f

grep
{$_}
@h{@f}
my
%h
=
(a
=>
'alpha',









b
=>
'beta');



%h
~~
/[A‐F]/i

grep
{/[A‐F]/i}
keys
%h
my
%h
=
(a
=>
'alpha',









b
=>
'beta');
my
%hh
=
(b
=>
1,
a
=>
2);

%h
~~
%hh

[sort
keys
%h]
~~
[sort
keys
%hh]
__END__

__DATA__
Андрей
Шитов
—
2007
andy@shitov.ru

|

http://shitov.ru

Mais conteúdo relacionado

Destaque

Destaque (6)

MíDia E Eu
MíDia E EuMíDia E Eu
MíDia E Eu
 
Что такое Moscow.pm (remix)
Что такое Moscow.pm (remix)Что такое Moscow.pm (remix)
Что такое Moscow.pm (remix)
 
Garfield
GarfieldGarfield
Garfield
 
Vas Servces by Rashad Aliyev
Vas Servces by Rashad AliyevVas Servces by Rashad Aliyev
Vas Servces by Rashad Aliyev
 
clandestinos
clandestinosclandestinos
clandestinos
 
Amigos De Verdade
Amigos De VerdadeAmigos De Verdade
Amigos De Verdade
 

Mais de Andrew Shitov

The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of Smartmatch
Andrew Shitov
 

Mais de Andrew Shitov (20)

Perl6 one-liners
Perl6 one-linersPerl6 one-liners
Perl6 one-liners
 
Creating a compiler in Perl 6
Creating a compiler in Perl 6Creating a compiler in Perl 6
Creating a compiler in Perl 6
 
Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)Fun with Raspberry PI (and Perl)
Fun with Raspberry PI (and Perl)
 
Perl6 in-production
Perl6 in-productionPerl6 in-production
Perl6 in-production
 
Параллельные вычисления в Perl 6
Параллельные вычисления в Perl 6Параллельные вычисления в Perl 6
Параллельные вычисления в Perl 6
 
AllPerlBooks.com
AllPerlBooks.comAllPerlBooks.com
AllPerlBooks.com
 
Perl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel ComputingPerl 6 for Concurrency and Parallel Computing
Perl 6 for Concurrency and Parallel Computing
 
The Joy of Smartmatch
The Joy of SmartmatchThe Joy of Smartmatch
The Joy of Smartmatch
 
YAPC::Europe 2013
YAPC::Europe 2013YAPC::Europe 2013
YAPC::Europe 2013
 
Perl 7, the story of
Perl 7, the story ofPerl 7, the story of
Perl 7, the story of
 
Язык программирования Go для Perl-программистов
Язык программирования Go для Perl-программистовЯзык программирования Go для Perl-программистов
Язык программирования Go для Perl-программистов
 
Как очистить массив
Как очистить массивКак очистить массив
Как очистить массив
 
What's new in Perl 5.14
What's new in Perl 5.14What's new in Perl 5.14
What's new in Perl 5.14
 
Что нового в Perl 5.14
Что нового в Perl 5.14Что нового в Perl 5.14
Что нового в Perl 5.14
 
Perl6 grammars
Perl6 grammarsPerl6 grammars
Perl6 grammars
 
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
 
There's more than one way to empty it
There's more than one way to empty itThere's more than one way to empty it
There's more than one way to empty it
 
Perl 6 by example
Perl 6 by examplePerl 6 by example
Perl 6 by example
 
How to clean an array
How to clean an arrayHow to clean an array
How to clean an array
 
Perl 5.10 и 5.12
Perl 5.10 и 5.12Perl 5.10 и 5.12
Perl 5.10 и 5.12
 

Смарт-матчинг (~~)