We help IT Professionals succeed at work.

make multiple copies of a file with slightly different names

dwcronin
dwcronin asked
on
126 Views
Last Modified: 2017-08-22
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?
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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.
dwcronindisabled

Author

Commented:
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.
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
dwcronindisabled

Author

Commented:
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----------------------------
CERTIFIED EXPERT
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
dwcronindisabled

Author

Commented:
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...