What's the point of using Perl if the one thing Perl can do really well is handled by a shell function?
Code:
#!/usr/bin/perl -n
if (m%<cd>(.*?)</cd>% { print "$1\n" }
Save that to a file and run it from a shell script which invokes it on each file in turn. Or just type this one-liner directly at the prompt.
Code:
perl -ne 'if (m%<cd>(.*?)</cd>%) { print "$1\n" }' *.txt >tmp.out