Copy one frame of a .xtd file as .xsd file in scripting

Hello All,

After the Amorphous Cell run, I have a .xtd file with only one frame in it. I want to copy out the structure and save as .xsd file. I did it like this and I am wondering whether it is ok or not:

#!perl

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

my %Args;
GetOptions(\\%Args, "Structure=s");
my \\\$doc = \\\$Documents{"\\\$Args{Structure}.xtd"};


\\\$doc->Export("./\\\$Args{Structure}.xsd");