Let us worry about your assignment instead!

We Helped With This Programming Homework: Have A Similar One?

More InfoProgramming Assignments Help

Short Assignment Requirements

Only task 1 is required (programming), please follow requirements closely mark scheme is on the last page. I will do task 2 (uploading), thank you.

Assignment Description

COMP284Assignment 1

COMP284 Scripting Languages (2017-18) -- Assignment

1: Perl and CGI

Your task for this practical assignment consists of two parts:

1.       Develop a Perl script using CGI.pm that performs a statistical analysis of program code and provides functionality stated in the Requirements section below.

2.       Make the Perl script that you have created accessible and usable via the URL http://cgi.csc.liv.ac.uk/cgi-bin/cgiwrap/<your user name>/analysis.pl

Take care that the access rights for the file analysis.pl are neither too restrictive nor too permissive.


Your Perl script should perform a statistical analysis of program code that the user provides via a web interface either by supplying a URL that indicates where the code can be retrieved or by entering the code directly into a text area.

The script should display a web page that contains a form with a text field, a text area, and a `Submit' button. The text field should allow the user to enter a single URL. The text area should allow a user to enter program code.

       If the user enters both a URL into the first text field and code into the text area and then presses the `Submit' button, then the system should indicate an error and allow the user to start again.

       If the user neither enters a URL nor enters code into the text area and then presses the `Submit' button, then the system should indicate an error and allow the user to start again.

       If the user only enters a URL into the text field and then presses the `Submit' button, then your script should retrieve the code that the URL points to. You do not need to check beforehand whether the URL is syntactically well-formed, but you should cater for the possibility that the URL is not valid, i.e., that there is nothing to retrieve at that URL, and indicate an error to the user in such a case. The code may not only contain ASCII characters but also UTF-8 characters and your script should handle those characters correctly when performing the analysis.

       If the user only enters program code into the text area and then presses the 'Submit button, then your script should simply take that code and proceed. Again, you should assume that the code may contain UTF-8 characters.

An example of the kind of program code that your script is expected to analyse is the following:


/* This is  a 

multi-line comment */ if ($counter > 0) {

print("$counter is zero") // comment to the end of the line

} else {

# single-line comment print("$counter is not zero")


You do not need to check whether the code is syntactically correct (in any programming language).

Your script should then determine the amount of comments in the code:

       Single-line comments either start with # or with // and run until the end of the line. The number of nonempty lines of comment for a single-line comment is 1 if the comment contains at least one Unicode word character and 0 otherwise.

       Multi-line comments start with /* and end with */ and span one or more lines between /* and */. The number of non-empty lines of comment for a multi-line comment is the number of lines of that comment that contain at least one Unicode word character.

       The number of words in a comment, for both single-line and multi-line comments, is simply the number of words in a comment where we assume that a word is a non-empty sequence of Unicode word characters separated by non-word characters.

       Finally, the number of non-trivial comments is the number of single-line and multi-line comments that is at least five words long (note: here a multi-line comment counts 1 no matter how many lines it has, if it contains at least five word).

       You can assume that comments cannot be nested.

If you remove all comments from the code, including the characters that start and end comments, as well as any empty lines and any lines containing only spaces and tabs, what remains are the instructions of the code.

We are interested in the number of elements of instruction and the number of lines of instruction:

       An element of instruction is either an identifier, that is, a non-empty sequence of the characters a-z, A-Z, 0-9, and underscore _ that does not start with a digit, or a symbolic operator, that is, a non-empty sequence of the symbols +, *, -, %, !, =, >, <, &, |. A symbolic operator can separate two identifiers, for example, length3-length4 consists of three elements of instruction ('length3', '-', 'length4'). Similarly, any character that can neither occur in an identifier nor in a symbolic operator, separates elements of instruction, for example, push("peter",123,stack) consists of three elements of instruction ('push', 'peter', 'stack').

       A line of instruction is a line in the instructions that contains at least one element of instruction. After performing this analysis, your script should first output the code it has received as input, in a way that preserves the layout and all elements of the code. If the code was retrieved from a URL, then the URL should also be shown.

Your script should then output the results of the analysis as a table indicating

       the number of lines of instruction,

       the number of elements of instruction,

       the number of non-empty lines of comment,

       the number of non-trivial comments,

       the number of words of comment,

       the ratio of the number of non-empty lines of comment to the number lines of instruction,

       the ratio of the number of non-trivial comments to the number lines of instruction,

       the ratio of the number of words of comment to the number of elements of instruction. Ratios should be rounded to 1 digit after the decimal point.

For the code example above the output would be:

Number of lines of instruction


Number of elements of instruction


Number of non-empty lines of comment


Number of non-trivial comments


Number of words of comment


Ratio of non-empty lines of comment to lines of instruction


Ratio of non-trivial comments to lines of instruction


Ratio of words of comment to elements of instruction


Code Analysis

Your code should follow the COMP284 Coding Standard. This includes pointing out which parts of your code have been developed with the help of on-line sources or textbooks and references for these sources.

Test data

Test data, together with the expected results, can be found at http://cgi.csc.liv.ac.uk/~ullrich/COMP284/tests-2017-18N/.


Submit your Perl script via the departmental submission system at https://sam.csc.liv.ac.uk/COMP/Submissions.pl?module=comp284 (COMP284-1: Perl). Do not forget to also complete the second part of the assignment.


The deadline for this practical assignment is

Friday, 2 March 2018, 17:00

Earlier submission is possible, but any submission after the deadline attracts the standard lateness penalties.

Please remember that a strict interpretation of `lateness' is applied by the Department, that is, a submission on Friday, 2 March 2018, 17:01 is considered to be a day late (analogously for submissions that are delayed further).


This practical assignment will address the following learning outcomes of the module:

       rapidly develop simple applications, both computer and web-based, using an appropriate scripting language;

       document and comment applications written using a scripting language.

This practical assignment will contribute 30% to the overall mark of COMP284. Failure on this assignment may be compensated by higher marks on other assignments for this module.

Marks will be awarded according to the following scheme:

       The Perl script is accessible via the required URL, works without producing script errors, all required files were submitted, the files accessible via the web are identical to those that were submitted, and the access rights of the files in your filestore must be such that no other user can view their contents in the filestore: 10

       Creating a web page, using CGI.pm, for user input, input checking and URL retrieval: 23

       Performing the code analysis: 37

       Creating a web page, using CGI.pm, showing the program code and the results of the analysis: 18

       Formatting, commenting, and quality of code: 12

As stated above, the University policy on late submissions applies to this assignment as does the University policy on Academic Integrity, which can be found at http://www.liv.ac.uk/student-administration/studentadministration-centre/policies-procedures/academic-integrity/. You should follow the COMP284 Lab Rules to ensure that you do not breach that policy.


© University of Liverpool - a member of The Russell Group

Departmental Contacts | University Contacts | Map | Legal | Accessibility

Frequently Asked Questions

Is it free to get my assignment evaluated?

Yes. No hidden fees. You pay for the solution only, and all the explanations about how to run it are included in the price. It takes up to 24 hours to get a quote from an expert. In some cases, we can help you faster if an expert is available, but you should always order in advance to avoid the risks. You can place a new order here.

How much does it cost?

The cost depends on many factors: how far away the deadline is, how hard/big the task is, if it is code only or a report, etc. We try to give rough estimates here, but it is just for orientation (in USD):

Regular homework$20 - $150
Advanced homework$100 - $300
Group project or a report$200 - $500
Mid-term or final project$200 - $800
Live exam help$100 - $300
Full thesis$1000 - $3000

How do I pay?

Credit card or PayPal. You don't need to create/have a Payal account in order to pay by a credit card. Paypal offers you "buyer's protection" in case of any issues.

Why do I need to pay in advance?

We have no way to request money after we send you the solution. PayPal works as a middleman, which protects you in case of any disputes, so you should feel safe paying using PayPal.

Do you do essays?

No, unless it is a data analysis essay or report. This is because essays are very personal and it is easy to see when they are written by another person. This is not the case with math and programming.

Why there are no discounts?

It is because we don't want to lie - in such services no discount can be set in advance because we set the price knowing that there is a discount. For example, if we wanted to ask for $100, we could tell that the price is $200 and because you are special, we can do a 50% discount. It is the way all scam websites operate. We set honest prices instead, so there is no need for fake discounts.

Do you do live tutoring?

No, it is simply not how we operate. How often do you meet a great programmer who is also a great speaker? Rarely. It is why we encourage our experts to write down explanations instead of having a live call. It is often enough to get you started - analyzing and running the solutions is a big part of learning.

What happens if I am not satisfied with the solution?

Another expert will review the task, and if your claim is reasonable - we refund the payment and often block the freelancer from our platform. Because we are so harsh with our experts - the ones working with us are very trustworthy to deliver high-quality assignment solutions on time.

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On

soc fb soc insta

Paypal supported