#!/usr/bin/perl
use strict;
use warnings;
use CGI;
# Tworzenie obiektu CGI
my $query = CGI->new;
# Pobranie parametrów z QUERY_STRING
my $params = $ENV{'QUERY_STRING'} || "";
# Rozdzielenie parametrów i obliczenie sumy
if ($params) {
my @numbers = split(/\+/, $params); my $sum = 0;
foreach my $num (@numbers) {
if ($num =~ /^\d+$/) {
$sum += $num;
} else {
print "Content-type: text/plain\n\n"; print "Błąd: Wszystkie parametry muszą być liczbami.\n"; }
}
print "Content-type: text/plain\n\n"; } else {
print "Content-type: text/plain\n\n"; print "Nie podano żadnych parametrów.\n"; }
IyEvdXNyL2Jpbi9wZXJsCnVzZSBzdHJpY3Q7CnVzZSB3YXJuaW5nczsKdXNlIENHSTsKCiMgVHdvcnplbmllIG9iaWVrdHUgQ0dJCm15ICRxdWVyeSA9IENHSS0+bmV3OwoKIyBQb2JyYW5pZSBwYXJhbWV0csOzdyB6IFFVRVJZX1NUUklORwpteSAkcGFyYW1zID0gJEVOVnsnUVVFUllfU1RSSU5HJ30gfHwgIiI7CgojIFJvemR6aWVsZW5pZSBwYXJhbWV0csOzdyBpIG9ibGljemVuaWUgc3VteQppZiAoJHBhcmFtcykgewogICAgbXkgQG51bWJlcnMgPSBzcGxpdCgvXCsvLCAkcGFyYW1zKTsKICAgIG15ICRzdW0gPSAwOwogICAgCiAgICBmb3JlYWNoIG15ICRudW0gKEBudW1iZXJzKSB7CiAgICAgICAgaWYgKCRudW0gPX4gL15cZCskLykgewogICAgICAgICAgICAkc3VtICs9ICRudW07CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgcHJpbnQgIkNvbnRlbnQtdHlwZTogdGV4dC9wbGFpblxuXG4iOwogICAgICAgICAgICBwcmludCAiQsWCxIVkOiBXc3p5c3RraWUgcGFyYW1ldHJ5IG11c3rEhSBiecSHIGxpY3piYW1pLlxuIjsKICAgICAgICAgICAgZXhpdDsKICAgICAgICB9CiAgICB9CgogICAgcHJpbnQgIkNvbnRlbnQtdHlwZTogdGV4dC9wbGFpblxuXG4iOwogICAgcHJpbnQgIlN1bWE6ICRzdW1cbiI7Cn0gZWxzZSB7CiAgICBwcmludCAiQ29udGVudC10eXBlOiB0ZXh0L3BsYWluXG5cbiI7CiAgICBwcmludCAiTmllIHBvZGFubyDFvGFkbnljaCBwYXJhbWV0csOzdy5cbiI7Cn0KCg==