Created
October 2, 2011 16:38
-
-
Save wsdookadr/1257610 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| use Storable qw/dclone/; | |
| use Data::Dumper; | |
| my $a = { | |
| '%h_outside' => { | |
| 'a' => 1, | |
| 'b' => 2 | |
| }, | |
| '@a_inside' => [ | |
| 'x', | |
| 'y', | |
| 3 | |
| ], | |
| '$s_inside' => 42, | |
| '$r_inside' => undef, | |
| '$r2_outside' => undef, | |
| '$s_outside' => 42, | |
| '%h_inside' => { | |
| 'a' => 1, | |
| 'b' => 2 | |
| }, | |
| '$r2_inside' => $a->{'$r_inside'}, | |
| '@a_outside' => [ | |
| 'x', | |
| 'y', | |
| 3 | |
| ], | |
| '$r_outside' => $a->{'$s_outside'}, | |
| }; | |
| my $b = { | |
| '%h_outside' => { | |
| 'a' => 1, | |
| 'b' => 2 | |
| }, | |
| '$r2_outside' => undef, | |
| '$s_outside' => 42, | |
| '@a_outside' => [ | |
| 'x', | |
| 'y', | |
| 3 | |
| ], | |
| '$r_outside' => $a->{'$s_outside'}, | |
| }; | |
| ####################### | |
| # computing complement | |
| ####################### | |
| my $b_c = dclone($a) ; # completement of $b with respect to $a | |
| delete $b_c->{$_} for keys %{$b}; | |
| print Dumper $b_c; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment