Help using perl commandline for XML matching

I have a file that contains this.

<NAME>/bob</NAME>

I'm trying to print just the /bob part to my screen. I have a command line example I really think should work. Keep in mind that the content between the <NAME> </NAME> is always changing.

$/tmp> perl -ne 'print /<NAME>($.)<\/NAME>/' file

Expected output: /bob

I'm not sure what I'm doing wrong. Many thanks for help.

-x96riley3

This works for me:

perl -ne "print /<NAME>(.*)<\/NAME>/" file.txt
/bob

In general regular expressions are poor at parsing XML & HTML, but for a one-liner hack, whatever works for you is ok.

$. counts how many lines of input have gone by. Sometimes it's also seen as "match the first character after a newline", but that never works as intended, too.