kurila116delta - what is new for Perl Kurila 1.16
This document describes differences between Perl Kurila 1.15 and Perl Kurila 1.16
Structured assignments.
Structured assignments are a new way, to extract values from complex structures.
For example:
%( aap => $aap, ?noot => $noot ) = $h;
$h must be an hash with a key aap and possible a key noot, the corresponding values are assigned to $aap and $noot. Assigns $aap to the key $noot.
$h
aap
noot
$aap
$noot
As a more basic example:
@( $a, $b ) = @list;
Assigns $a to the first element, and $b the second element. If there are more elements in the list an error is raised. To allow for more element do
$a
$b
@($a, $b, ...) = @list;
To allow assignment without two elements ad a ? in front of the variable:
?
@($a, ? $b, ...) = @list;
If @list only has only element $b will be set to undef. Similairly for hashes:
@list
undef
%( aap => $aap, ?noot => $noot, ... ) = $h;
$h must be a hash which must have the key aap. $aap is assigned the value of $h{aap}, and $noot is assigned the value of $h{?noot}. Extra values in a hash or array can be ignored using ... or assigned to hash or array using @< or %<. For example:
$h{aap}
$h{?noot}
...
@<
%<
@($a, @< $remaining) = @list
Assigns the first element of @list to $a and the remaining elements to $remaining.
$remaining
@( $a, %< $h ) = @( "arg1", "key1" => "value1" );
After the assignment $a is "arg1" and $h is %( "key1" => "value1" )
"arg1"
%( "key1" => "value1" )
Improve assignments.
Default when you access a hash key or array element which does not exists an error is raised. To automaticly create the hash key or array element if it does not exists, add the + operator to the key, i.e. $h{+$key}. To ignore accessing a non-existent key or element, add the ? to the key, i.e. @a[?$i].
+
$h{+$key}
@a[?$i]
Direct control over the creation and access of hash and array elements.
List assignments are no longer possible
List assignments have been removed in favour of structured assigments.
Documentation has not been updated for many of the changes for kurila.
Assigning some value to a part of itself behaves unexpected.
Tied hashes do not work correctly with complex data structures. Assigning arrays or hashes to a value of tied hash might behave strange.
Perl Kurila has only been tested/build for x86_64-linux-gnu-thread-multi platform.
The INSTALL file for how to build Perl Kurila.
The README file for general stuff.
The Artistic and Copying files for copyright information.
Written by Gerard Goossen <gerard@tty.nl>.
To install kurila, copy and paste the appropriate command in to your terminal.
cpanm
cpanm kurila
CPAN shell
perl -MCPAN -e shell install kurila
For more information on module installation, please visit the detailed CPAN module installation guide.