in reply to create hash using grep

If you want grep and $c must be a reference here is one way:
#! /usr/bin/perl $a = { aa => 'b', bb => 'd', le1 => 'sad', le2 => 'ss' } ; my @keys = grep { ! /le/ } keys %$a ; @$c{@keys} = @$a{@keys}; foreach (keys %$c) { print "key=$_ et val=$c->{$_}\n" ; }
Boris

Replies are listed 'Best First'.
Re^2: create hash using grep
by jeanluca (Deacon) on Feb 21, 2006 at 12:33 UTC
    yes!! but what is the @$c{@keys} ?
    Where can I read about this type of variable usage... ?

    Luca
        Whereever I look I don't see anything that looks like @$c{..} So maybe you can be a little bit more precise were it is explained.
        Thnx for you patience :)
        Luca