Besides the syntax errors that others have already corrected, I'd like to make some suggestions.

You use 15 differently named input fields. Perhaps you don't know that when you create 15 that all have the same name, you can get a list from $q->param.

Photo 1: <input type=file name=photo><br> Photo 2: <input type=file name=photo><br> Photo 3: <input type=file name=photo><br> ...
#!/usr/bin/perl -w use strict; use CGI; my $cgi = CGI->new; my @pictures = $cgi->param('photo'); ...

You don't check the value of $album and then you use it. This means that anyone can create directories anywhere the web server can. Very dangerous.

The script doesn't check if open succeeded. When it can't create the file, it silently continues.

It is a very good idea to indent your code. Inside {} blocks, indent everything to visualize the block. This makes reading code much easier. Especially when you ask for help, you should do everything you can to make it easy to read.

I forgot the most important mistake. The code doesn't use strict. Always use strict!

use strict;
Your code will not work with strict without modification. A good Perl book or tutorial will tell you how to change your code. If you don't already have a good Perl book, try Beginning Perl. It's free.

Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }


In reply to Re: Confusing Syntax by Juerd
in thread Confusing Syntax by eoin

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.