Are there things that I did not try which would have been likely to succeed.

Not really :) but see next part

Is there a way to use that reference directly with Tie::Hash::Regex without making the copy?

Its not really important :) but see next part

#!/usr/bin/perl -- use strict; use warnings; use Tie::Hash::Regex; Main( @ARGV ); exit( 0 ); sub Tie::Hash::Regex::TIEHASH { my( $class, $ref ) = @_; $ref ||= {}; return bless $ref, $class; } sub Main { my $sing = bless setSome(), 'Tie::Hash::Regex'; my %song; tie %song, 'Tie::Hash::Regex', setSome(); print $sing->FETCH(qr/pe/i), "\n"; print $song{qr/by/i}, "\n"; #~ typeSome( \%song ); #~ typeSome( $sing ); } sub setSome { my( $song ) = @_;; $song ||= {}; $song->{Peter} = "I Am Peter, Hear Me Roar"; $song->{Byrne} = "When I have nothing to say, my lips are sealed." +; $song; } sub typeSome { my( $song ) = @_; while( my( $writer, $song ) = each %$song ){ print "$writer: $song\n"; } } __END__

And this is the point you should consider perlobj :)


In reply to Re: Tie::Hash::Regex to hash reference? by Anonymous Monk
in thread Tie::Hash::Regex to hash reference? by wjw

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.