Avatar of dwcronin
dwcronin
Flag for United States of America asked on

make multiple copies of a file with slightly different names

I'm trying to write a Perl script to name cemetery files in an organized manner.  The files are for lots in section B of the cemetery.  Each lot is designated by a 3 digit number and so I'm trying to name them:
Blot043, Blot100, etc.  
My script doesn't work.  What wrong with it?
Perl

Avatar of undefined
Last Comment
dwcronin

8/22/2022 - Mon
FishMonger

Saying your script doesn't work is a very poor problem description.

In what way is it failing?

How do the results differ from what you expect?

What errors and warnings are you receiving?

You need to show us the script.
dwcronin

ASKER
You're.  I thought that the script was attached.  It's very short and I was hoping it would be apparent.
Here are the missing parts:

-------------------------script-------------
foreach$lotnumber (qw/ 043 044 046 047 049 050 053 055 056 057 058 061 062 063 064 066 067 068 069 070 071 072 073 074 075 076 077 078 080 081 082 083 084 085 086 087 088 090 091 092 094 095 97 097 098 099 100 101 102 103 104 105 106 107 108 109 112 113 114 115 116 117 119 120 121 123 124 127 128 129 130 131 132 133 138 139 140 141 142 143 144 145 146 147 148 149 150 152 153 154 156 158 159 160 161 162 164 165 166 167 168 169 170 172 173 174 175/){
copy gridlots Blot$lotnumber}; #copy gridlot for each blot
----------------------------------------------------------------------------------
perl makelot.pl
Can't locate object method "Blot" via package "043" (perhaps you forgot to load "043"?) at makelots.pl line 2.
ASKER CERTIFIED SOLUTION
FishMonger

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
dwcronin

ASKER
I'm sorry but I haven't had time to make this an array.  That sounds much better, but I don't know the syntax of an array.  it is now:
-----------------------------start of script---------------------------------------------------------------------
use warnings;
use strict;
foreach$lotnumber (qw/ "043 044 046 047 049 050 053 055 056 057 058 061 062 063 064 066 067 068 069 070 071 072 073 074 075 076 077 078 080 081 082 083 084 085 086 087 088 090 091 092 094 095 97 097 098 099 100 101 102 103 104 105 106 107 108 109 112 113 114 115 116 117 119 120 121 12off3 124 127 128 129 130 131 132 133 138 139 140 141 142 143 144 145 146 147 148 149 150 152 153 154 156 158 159 160 161 162 164 165 166 167 168 169 170 172 173 174 175"/){
copy gridlots.svg, Blot$lotnumber.svg}; #copy gridlot for each blot
-------------------------------------------------end of script-------------------------------------------------
------------------  start of errors--------------------
perl makelots.pl
Global symbol "$lotnumber" requires explicit package name (did you forget to declare "my $lotnumber"?) at makelots.pl line 3.
Global symbol "$lotnumber" requires explicit package name (did you forget to declare "my $lotnumber"?) at makelots.pl line 4.
Bareword "svg" not allowed while "strict subs" in use at makelots.pl line 4.
Bareword "svg" not allowed while "strict subs" in use at makelots.pl line 4.
Execution of makelots.pl aborted due to compilation errors.

----------------- end of errors----------------------------
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
dwcronin

ASKER
I changed the code in the way I hope is more manageable by "trying" to make this an array.  The numbering of the lots seems foolish but I talked to the gravedigger who has done this job for 40+ years and he shrugged and had no explanation either.  Anyway, Perl says "illegal octal digit 8 or 9" in many lines of my file.  Now this way doesn't work either...