I agree with Bloodnok about the data structure. You have a Hash of Array. Basically this is a hash key that points to not one value, but actually a reference to a list of values.

The q/11.5/ syntax is a type of a Perl quote and it just means '11.5'. There are a bunch of these short-cut quote operators in Perl (q(single quote),qq (double quote), qw (quote word),etc). If you are going to write more Perl, buy "Programming Perl" by Larry Wall, Tom Christiansen and Jon Orwant and look at page 63 which has a table about this "quoting" subject.

I prefer the below synatx.

$hashA{q/11.5/} = [ grep { $_ != 1734789 } @{$hashA{q/11.5/}} ];
First, @{$hashA{q/11.5/}}, the q/11.5/ just means '11.5'.
$hashA{'11.5'} points to an anonymous array of values.
@{$hashA{q/11.5/}} expands that anonymous array into a list of values
That list goes into grep which makes a yes/no decision for each list item.
If the value is not 1734789 then the value gets put into yet another anonymous list. Meaning that values = 1734789 are deleted.
The output of the grep{} is a list and the enclosing [ ] brackets around this big expression allocate memory for that list which is then assigned back to the $hashA{'11.5'} key.

See below code.

#!/usr/bin/perl -w use strict; use Data::Dumper; my %hashA = ( '11.5' => [ 1723478, 1734789, 1798761, ], '11.12' => [ 1700123, ], '11.01' => [ 1780345, ] ); print Dumper (\%hashA); $hashA{q/11.5/} = [ grep { $_ != 1734789 } @{$hashA{q/11.5/}} ]; print Dumper (\%hashA); __END__ Prints: $VAR1 = { '11.01' => [ 1780345 ], '11.12' => [ 1700123 ], '11.5' => [ 1723478, 1734789, 1798761 ] }; $VAR1 = { '11.01' => [ 1780345 ], '11.12' => [ 1700123 ], '11.5' => [ 1723478, 1798761 ] };
1734789 was in the anonymous array assigned to $hashA{'11.5'} and it is no longer there.

In reply to Re: Hash: Removing a specific value from a multi-valued key by Marshall
in thread Hash: Removing a specific value from a multi-valued key by eshwar

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.