This is not really about hard versus soft references, but about different data types that happen to have the same name. In the statements
    $removed = [ @removed ];
and
    $removed = \@removed;
the scalar  $removed is the same thing: a hard reference to an array. In the first case, the reference is to an anonymous array created | initialized by a shallow copy from the  @removed array. In the second case, the reference is directly to the  @removed array. Again, both references are hard references, not soft (or symbolic) references. There are no soft references in the OPed code.

It is a "feature" of Perl that the variables  $foo @foo %foo &foo and maybe a few others are all different data types which can be made to have the same name (usually a practice to be avoided, IMHO).

Update: Here's some code that might give a better idea of what's going on:

c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dump qw(pp); ;; my @ra = qw(a b c d); print 'A: ', pp \@ra; ;; my $hardref = [ @ra ]; print 'B1: ', pp $hardref; pop @{$hardref}; print 'B2: ', pp $hardref; print 'B3: ', pp \@ra; ;; $hardref = \@ra; pop @{$hardref}; print 'C1: ', pp $hardref; print 'C2: ', pp \@ra; " A: ["a" .. "d"] B1: ["a" .. "d"] B2: ["a", "b", "c"] B3: ["a" .. "d"] C1: ["a", "b", "c"] C2: ["a", "b", "c"]


Give a man a fish:  <%-{-{-{-<


In reply to Re: hard versus soft reference to ARRAY's by AnomalousMonk
in thread hard versus soft reference to ARRAY's by teun-arno

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.