I have a string of the following format:
word1.word2.word3
What are the ways to extract word2 from that string in perl? I tried the following expression but it assigns 1 to sub:
@perleval $vars{sub} = $vars{string} =~ /.(.*)./; 0@
EDIT:
I have tried several suggestions, but still get the value of 1. I suspect that the entire expression above has a problem in addition to parsing. However, when I do simple assignment, I get the correct result:
@perleval $vars{sub} = $vars{string} ; 0@
assigns word1.word2.word3 to variable sub