HI,
i'd like to use regexp replacement without changing variable value.
for example : in the following code i'd like to preseve the value of $key, but i need to change it's value in order to use it as an hash key. however, the hash key is only temporal and can be destroyed right after getting the hash.
the question is whether i can perform the above code without using the $temp.
thanks,
i'd like to use regexp replacement without changing variable value.
for example : in the following code i'd like to preseve the value of $key, but i need to change it's value in order to use it as an hash key. however, the hash key is only temporal and can be destroyed right after getting the hash.
Code:
my $key = "aaa.bbb.ccc"; my $temp =~ s/\.ccc//; print $hash{$temp};
thanks,
Comment