This is what 'db' is showing:
> perl -d snapper.pl -X x /home Loading DB routines from perl5db.pl version 1.37 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(snapper.pl:5): our $VERSION = '0.0.2'; DB<1> b Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp DB<2> c Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp(snapper.pl:832): 832: my $lvm = shift; DB<2> s Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp(snapper.pl:833): 833: my ($base_lvh, $lv_mp) = @_; DB<2> s Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp(snapper.pl:834): 834: my $diff_dev = pathcat("/dev", 835: + $base_lvh->vg_name, $base_lvh->lv_name . ".diff"); DB<2> n Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp(snapper.pl:837): ------------ #### here is where I have the problem the return from the 'by_mp' -- +you'll see $lv_mp."diff" a bit below.... 837: my $bdiff_lvh = (@_ && $lvm->by_mp($lv_mp . ". +diff")) or 838: $lvm->by_devpath( 839: pathcat("/dev", $base_lvh->vg_name, $b +ase_lvh->lv_name . ".diff")); DB<2> s Lvm::Maps::by_mp(/home/law/bin/lib/Lvm_Utils.pm:793): 793: sub by_mp(;$) { my $map = shift; my $c = ref $map || $ +map; DB<2> s Lvm::Maps::by_mp(/home/law/bin/lib/Lvm_Utils.pm:793): 793: sub by_mp(;$) { my $map = shift; my $c = ref $map || $ +map; DB<2> s Lvm::Maps::by_mp(/home/law/bin/lib/Lvm_Utils.pm:794): 794: bless $map = $map->new(), $c unless ref $map; DB<2> s Lvm::Maps::by_mp(/home/law/bin/lib/Lvm_Utils.pm:795): 795: my $arg = $_[0]; DB<2> s Lvm::Maps::by_mp(/home/law/bin/lib/Lvm_Utils.pm:796): 796: $map->_init_by_mp unless $map->{_by_mp}; DB<2> p $arg /home.diff ----- ^^Above^^ is the string I passed in... so then I 'r'eturn from the rou +tine and see: DB<3> r scalar context return from Lvm::Maps::by_mp: '_chunksize' => undef '_d_type' => undef '_fs_perms' => undef '_fs_type' => Fs::Xfs=HASH(0x2198c08) 'mount_ops' => 'nodiratime,noatime,swalloc' 'name' => 'xfs' 'snapshot_ops' => 'nouuid,norecovery,ro' '_fs_type_name' => 'xfs' 'cfg' => undef 'fs_mp' => undef 'lv_attr' => '-wc-ao---' 'lv_kernel_major' => 254 'lv_kernel_minor' => 9 'lv_name' => 'Home.diff' 'lv_path' => '/dev/HnS/Home.diff' 'lv_size' => 549755813888 'origin' => '' 'vg_extent_size' => 4194304 'vg_name' => 'HnS' Lvm::Snapshot_Ops::lvm_BaseDiff_Lvh_4_Base_opt_mp(snapper.pl:840): 840: die P "Can't find \"diff\" dir for vol %s by m +ount or device path", $lv_mp 841: unless ref $bdiff_lvh;

Now you are right, I could just throw curlies around that and create a NEW HASH from my **reference**, but gosh darnit... I'd rather it NOT dereference it in the the first place! Isn't the fact that it "expands it", then is stuck in a new anonymous hash, even meaning that not only has it done extra work, but the new hash isn't even the same hash (in memory) as they old (i.e. if I changed something in the hash, it would change the anon-copy, as I didn't get back the pointer I wanted to the original hash.

Does that make it more clear?

If you can tell by the line numbers, -- that's 1 of 2 main program files, with scads of little support libs thrown in for fun. So I'm just not sure how to prevent it from "returning the expansion of the HASH pointed to by the reference...(without, as you say, creating a new anon-hash -- which isn't really returning my reference that I want, at all!)


In reply to Re^2: How to return values from a hash? by perl-diddler
in thread How to return values from a hash? by perl-diddler

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.