You have stuck strictures (use strict; use warnings;) at the start of the script you have shown us, but most of the errors NetWallah describes in Re: Syntax Error deleting files and folders in a directory would be picked up by strictures but are masked by an error you don't describe:

Possible attempt to separate words with commas at noname.pl line 4. "make_path," is not exported by the File::Path module Can't continue after import errors at noname.pl line 4. BEGIN failed--compilation aborted at noname.pl line 4.

After fixing the first error flagged by strictures we get:

Parentheses missing around "my" list at noname.pl line 16. "my" variable @files masks earlier declaration in same scope at noname +.pl line 20. Global symbol "$deleletes" requires explicit package name at noname.pl + line 20. Execution of noname.pl aborted due to compilation errors.

I guess the first of those errors is the one you are having trouble with, but it's a little hard to tell because it's not on the line you describe and you don't tell us what the actual error is. However strictures picked up four out of five serious errors that NetWallah reported. tobyink reported another error and it is very likely that:

my $destinationDir = 'C:\Users\Shaun\Documents\$website';

which assigns a path string ending in '$website' (not the contents of the Perl variable $website) to the variable $destinationDir is probably not what you intended, but given the absence of $website elsewhere in the script it's hard to be sure.

So a bunch of lessons here:

  1. Always use strictures (use strict; use warnings; - see The strictures, according to Seuss).
  2. Fix first things first.
  3. When asking for help provide all the relevant information you have.

Oh, and as an aside: don't use tabs for indentation. Convince Eclipse (with a blunt instrument if need be) to insert spaces instead of tabs. Your indentation is fine, but the tab characters screwed up what NetWallah saw.

True laziness is hard work

In reply to Re: Syntax Error deleting files and folders in a directory by GrandFather
in thread Syntax Error deleting files and folders in a directory by smturner1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.