Invoke this with the dependecy file (file-B) as the first argument and the base file (file-A) as stdin or the second and subsequent arguments:
undef $/;
# slurp in dependency file
my $depfile = shift(@ARGV);
open FH, '<', $depfile or die $depfile;
my $tag = <FH>;
close FH;
print $tag;
# slurp in the base file
$_ = <>;
# replace section with the dependecy file
s{<TagName>\s*<TagA>MyBaseFile</TagA>\s*<TagB>MyBaseFileID</TagB>\s*</TagName>\s*}{$dep}ms;
print;
Will this still work where File A has multiple <TagName> sections? will it only replace one <TagName> section that I am concerned about?
File A has numerous <TagName> sections, I only want to replace one (could appear anywhere) where the <TagName><TagA> section has a value of say 'MyBaseFile' etc...
What I supplied will replace the first instance of <TagA>MyBaseFile</TagA> in the file. Depending on how complicated your files actually are (I assume that what you supplied was a sample), you may want to look at xml parsing modules which can give you very fine control over what is selected..