Perl has almost all operators that C has, here just few operators that C doesn't.

Unary &

The address of operator. Perl's \ operator(for taking a reference ) fill the same ecological niche, however:

$ref_to_var =\$var;

But reference are much safer than addresses.

Unary *

The dereference address operator. Since Perl doesn't have addresses, it doesn't need to dereference addresses. It does have references though, so Perl's variable prefix characters serve as dereference operators, and indicate type as well:

$,@,% and &. 

Oddly enough, there actually is a * dereference operator, but since * is the funny character indicating a typeglob, you wouldn't use it the same way.


The typecasting operator. Nobody likes to be typecst anyway.

Comments powered by CComment