in reply to modify list through grep

If an array of references suffices then:

use strict; use warnings; my @l = ( "a", "b", "c" ); my @m = map {\$_} grep /a/, @l; ${$m[0]} = "z"; print @l;

seems to do what you want:

zbc

DWIM is Perl's answer to Gödel