summaryrefslogtreecommitdiffstats
path: root/Code/Perl
diff options
context:
space:
mode:
Diffstat (limited to 'Code/Perl')
-rwxr-xr-xCode/Perl/func_abc.pl20
-rwxr-xr-xCode/Perl/func_malloc.pl18
-rwxr-xr-xCode/Perl/func_slow.pl20
-rwxr-xr-xCode/Perl/hello.pl3
-rwxr-xr-xCode/Perl/hello_strict.pl5
5 files changed, 66 insertions, 0 deletions
diff --git a/Code/Perl/func_abc.pl b/Code/Perl/func_abc.pl
new file mode 100755
index 0000000..394f1c2
--- /dev/null
+++ b/Code/Perl/func_abc.pl
@@ -0,0 +1,20 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+ sleep 1;
+}
+
+sub func_b {
+ print "Function B\n";
+ sleep 1;
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ sleep 1;
+ func_b();
+}
+
+func_a();
diff --git a/Code/Perl/func_malloc.pl b/Code/Perl/func_malloc.pl
new file mode 100755
index 0000000..5340c82
--- /dev/null
+++ b/Code/Perl/func_malloc.pl
@@ -0,0 +1,18 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+}
+
+sub func_b {
+ print "Function B\n";
+ my $b = "B" x 100_000;
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ func_b();
+}
+
+func_a();
diff --git a/Code/Perl/func_slow.pl b/Code/Perl/func_slow.pl
new file mode 100755
index 0000000..f32d09e
--- /dev/null
+++ b/Code/Perl/func_slow.pl
@@ -0,0 +1,20 @@
+#!./perl -w
+
+sub func_c {
+ print "Function C\n";
+ for (my $i = 0; $i < 3000000; $i++) { my $j = $i + 1; }
+}
+
+sub func_b {
+ print "Function B\n";
+ for (my $i = 0; $i < 2000000; $i++) { my $j = $i + 1 ; }
+ func_c();
+}
+
+sub func_a {
+ print "Function A\n";
+ for (my $i = 0; $i < 1000000; $i++) { my $j = $i + 1; }
+ func_b();
+}
+
+func_a();
diff --git a/Code/Perl/hello.pl b/Code/Perl/hello.pl
new file mode 100755
index 0000000..3ca70a2
--- /dev/null
+++ b/Code/Perl/hello.pl
@@ -0,0 +1,3 @@
+#!./perl
+
+print "Hello World!\n";
diff --git a/Code/Perl/hello_strict.pl b/Code/Perl/hello_strict.pl
new file mode 100755
index 0000000..78003a9
--- /dev/null
+++ b/Code/Perl/hello_strict.pl
@@ -0,0 +1,5 @@
+#!./perl -w
+
+use strict;
+
+print "Hello World!\n";
OpenPOWER on IntegriCloud