aboutsummaryrefslogtreecommitdiff
path: root/challenge-180
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-180')
-rwxr-xr-xchallenge-180/dario-mazzeo/perl/ch-1.pl19
-rwxr-xr-xchallenge-180/dario-mazzeo/perl/ch-2.pl17
2 files changed, 36 insertions, 0 deletions
diff --git a/challenge-180/dario-mazzeo/perl/ch-1.pl b/challenge-180/dario-mazzeo/perl/ch-1.pl
new file mode 100755
index 0000000000..a0dc7380c5
--- /dev/null
+++ b/challenge-180/dario-mazzeo/perl/ch-1.pl
@@ -0,0 +1,19 @@
+# THE WEEKLY CHALLENGE - 180
+# Task 1: First Unique Character
+# Autore: Dario Mazzeo
+
+my $s="Perl Weekly Challenge";
+my $s="Long Live Perl";
+my %freq=();
+
+for (my $i=0; $i<length($s); $i++){
+ $freq{substr($s,$i,1)}++;
+}
+
+for (my $i=0; $i<length($s); $i++){
+ my $c=substr($s,$i,1);
+ if ($freq{$c}==1){
+ print "$i '$c' e' il primo carattere univoco\n";
+ last;
+ }
+} \ No newline at end of file
diff --git a/challenge-180/dario-mazzeo/perl/ch-2.pl b/challenge-180/dario-mazzeo/perl/ch-2.pl
new file mode 100755
index 0000000000..990d8dc0ee
--- /dev/null
+++ b/challenge-180/dario-mazzeo/perl/ch-2.pl
@@ -0,0 +1,17 @@
+# THE WEEKLY CHALLENGE - 180
+# Task 2: Trim List
+# Autore: Dario Mazzeo
+
+my @n=(9,0,6,2,3,8,5);
+my $i=4;
+
+my @out=();
+foreach my $j (@n){
+ if ($j>$i){
+ push(@out, $j);
+ }
+}
+
+my $output="(@out)";
+$output=~s/ /,/g;
+print "$output\n"; \ No newline at end of file