Bead connector in mesostructure

Hello everyone,

I have a mesostructure in which I wish to delete all bead connectors connected to bead A. I tried running the following script -

#!perl

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

my \\\$doc=\\\$Documents{"Mesostructure.xsd"};
my \\\$beads=\\\$doc->UnitCell->Sets("S")->Beads;
my \\\$connectors = \\\$doc->UnitCell->BeadConnectors;
foreach my \\\$connector (@\\\$connectors) {
my \\\$bead1 =\\\$doc->UnitCell->Beads("X");
my \\\$bead2 =\\\$doc->UnitCell->Beads("A");
\\\$connector->\\\$bead1; 
\\\$connector->\\\$bead2;
\\\$connector->Delete;
}


But I get the error - 'The index value is invalid (function/property "Beads") at -e line 11.' Can someone tell if there is a way to do this? 


Thanks,

Ricky