<http://forum.pspad.com/read.php?f=2&i=11581&t=11533>
----------------------------------------------------------------
Hello man,
In perl you can do stuff like this:
@ar - normal array
%ha - normal hash
$var - at first look normal scalar variable
( ar, ha and var are just example names )
Now the problem for highlighters come that perl permits several syntax
freedoms, such as for example a scalar variable could be a reference to
something else:
@$ar - now we tell that $ar is a reference to array so perl could
understant that
%$ha - now we tell that $ha is a reference to a hash
both of this we can also say like this:
@{$ar}
%{$ha}
and it means completely the same.
or like this:
[EMAIL PROTECTED]
\%ha
here we indicate a reference to the array and to the hash, nothing happens
with the hash and array themselves.
Also consider the heredoc format of string variables like this:
my $a = <<txt;
abc
bcd
txt
This is very useful technique available also in other languages, such as
php and many highlighters fail to catch that;
Actually what confuses at begining is that in perl you can pass to a
standart scalar variable a reference to whatever you want.
For example this:
$ar1 = [ 1, 4, 2 ];
$ar2 = [ 44, 53, 1 ];
$arr->[ 0 ] = $ar1;
$arr->[ 0 ] = $ar2;
Got it :)
ALSO something where all fails is that in perl you can pass a standart
scalar variable a reference to a function:
my $func = sub {
print( "hello!" );
};
It's hard to parse perl i suppose :)
Regards: Evgueny
--
PSPad freeware editor http://www.pspad.com