in reply to Re: Regexs on Hash Keys
in thread Regexs on Hash Keys
I don't think your first one works. Here is a modified version:
$fdat{$_} = $fdat{"redirect_$_"} for map { /^redirect_(.*)$/ ? $1 : () } keys %fdat;
Update: I did a lot of work for nothing. In a list context, a matching m// returns the list of captures, ($1), in this case. And a non-matching m// returns the empty list, (), not for example, a list containing one false value. This last item has bitten me several times; you'd think I'd have learned by now. ):
Thanks to chipmunk for reminding me of this.
- tye (but my friends call me "Tye")
|
|---|