Perl script

Hi MS Users,

I am trying to write a self crosslinking script.The Yellow atom is the reaction atom with the name R1.I want to put these two atoms in two variables (or an array) respectively.How should I write them?

Thanks in advance.


#!perl

use strict;
use Getopt::Long;
use MaterialsScript qw(:all);

my \\\$doc = \\\$Documents{"1.xsd"};
my \\\$atoms = \\\$doc->DisplayRange->Atoms;
my \\\$atom1;my \\\$atom2;my \\\$atom3;my \\\$atom4;my @atom;

foreach my \\\$atom(@\\\$atoms){

if (\\\$atom->Name eq "R1")
{ \\\$atom1 =\\\$atom;
foreach my \\\$atom_1(@\\\$atom1){
???
 
}
}  
}