<?xml version="1.0" encoding="windows-1252"?>
<node id="963154" title="Re: Search and Replace Elements from 1 array to another." created="2012-04-02 20:04:18" updated="2012-04-02 20:04:18">
<type id="11">
note</type>
<author id="892462">
Riales</author>
<data>
<field name="doctext">
&lt;p&gt;Does your code compile? O.o&lt;/p&gt;

&lt;p&gt;Anyways, I think you might be overcomplicating things. This seems to do what you want:&lt;/p&gt;

&lt;code&gt;
my @stu = (
	'103_dsu 1 35 nbu103',
	'104_dsu 1 35 nbu104',
	'204_tape 1 1 ACS1',
	'101_dsu 1 35 nbu101',
);

my @dp = (
	'nbu103 Disk 6 -1',
 	'nbu104 Disk 6 -1',
	'nbu101 Disk 6 -1',
);

foreach my $stu (@stu) {
	my (undef, undef, undef, $possible) = split ' ', $stu;
    my ($matched_dp) = grep {
        my ($dp) = split ' ', $_;
        $dp eq $possible
    } @dp;

    $stu = $matched_dp if $matched_dp;
}

use Data::Dumper;
print Dumper(@stu);
&lt;/code&gt;</field>
<field name="root_node">
963136</field>
<field name="parent_node">
963136</field>
</data>
</node>
