Error in script

How to eliminate "requires explicit package" error from script? Any platform where we can learn script writing in material studio (any reference)?

#!perl

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

my \\\$repeatUnit = Documents->Import("structures://repeat-units/olefins/ethylene.msi");
my \\\$polymer = Tools->PolymerBuilder->Homopolymer->Build(\\\$doc, \\\$repeatUnit, 10);


output:

Global symbol "\\\$doc" requires explicit package name at -e line 8.
Execution of -e aborted due to compilation errors.