Dear Monks, it seems, that %+ refuses regular attempts of cloning it:
#!/usr/bin/perl use strict; use warnings; use Storable qw(dclone); use Data::Dumper; my $str = "Rico"; $str =~ m{(?<name>ico)}xms; my $match = dclone \%+; print \%+,"\n"; print "match: $match\n", Dumper($match); $str =~ m{(?<buba>R)}xms; my $match2 = dclone \%+; print \%+,"\n"; print "match: $match\n", Dumper($match); print "match2: $match2\n", Dumper($match2);

edit:

output on my machine:

HASH(0x1c6fba0)
match:  HASH(0x1a20d48)
$VAR1 = {
          'name' => 'ico'
        };
HASH(0x1c6fba0)
match:  HASH(0x1a20d48)
$VAR1 = {
          'buba' => 'R'  # <- now this is unexpected
        };
match2: HASH(0x1a4baf0)
$VAR1 = {
          'buba' => 'R'
        };
In contrast, the following code works as expected:
my %test = ( hula => 1, ); my $testclone = dclone \%test; print "test: $testclone\n", Dumper($testclone); %test = ( different => 1, ); my $testclone2 = dclone \%test; print "test: $testclone\n", Dumper($testclone); print "test2: $testclone2\n", Dumper($testclone2);

What's going on here? The cloned hashref ($match) changes content although it has (and keeps) a different address.

$ perl -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration +: Platform: osname=linux, osvers=2.6.30-tuxonice-r5, archname=x86_64-linux-thr +ead-multi uname='linux sol 2.6.30-tuxonice-r5 #1 smp preempt tue sep 1 15:41 +:45 cest 2009 x86_64 intel(r) core(tm)2 cpu t7200 @ 2.00ghz genuinein +tel gnulinux ' config_args='-des -Duseshrplib -Darchname=x86_64-linux-thread -Dcc +=x86_64-pc-linux-gnu-gcc -Doptimize=-march=core2 -O2 -pipe -Dscriptdi +r=/usr/bin -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dprivlib=/usr +/lib64/perl5/5.10.1 -Darchlib=/usr/lib64/perl5/5.10.1/x86_64-linux-th +read-multi -Dvendorlib=/usr/lib64/perl5/vendor_perl/5.10.1 -Dvendorarch=/usr/ +lib64/perl5/vendor_perl/5.10.1/x86_64-linux-thread-multi -Dsitelib=/usr/lib64/perl5/site_perl/5.10.1 -Dsitearch=/usr/lib64/ +perl5/site_perl/5.10.1/x86_64-linux-thread-multi -Dlibperl=libperl.so.5.10.1 -Dlocincpth= -Duselargefiles -Dd_semc +tl_semun -Dinc_version_list=5.10.0 5.10.0/x86_64-linux-thread-multi - +Dcf_by=Gentoo -Dmyhostname=localhost -Dperladmin=root@localhost -Dinstallusrbinperl=n -Ud_csh -Uusenm -Dusethreads -Ui_ndbm -Ui_gdb +m -Ui_db -Dusrinc=/usr/include -Dlibpth=/usr/local/lib64 /lib64 /usr/ +lib64' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef

Bye
 PetaMem
    All Perl:   MT, NLP, NLU


In reply to %+ and cloning by PetaMem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.