Permalink
Browse files

2012-4-11 from csair-zhaowe

  • Loading branch information...
1 parent 996b58b commit 7985b4713ebdd40fed2ae60918ae9b7b07a321c5 @zhaowe committed Apr 11, 2012
Showing with 21 additions and 0 deletions.
  1. +4 −0 ex3-1.pl
  2. +9 −0 ex3-2.pl
  3. +8 −0 ex3-3.pl
View
@@ -0,0 +1,4 @@
+# reads a list of strings on separate lines until end-of-input
+# and prints out the list in revers order.
+@lines = <STDIN>;
+print reverse @lines;
View
@@ -0,0 +1,9 @@
+# reads a list of numbers (on separate lines) until end-of-input
+# and then prints for each number the corresponding person's name
+# from the list shown below.
+# fred betty barney dino wilma pebbles bamm-bamm
+@names = qw(fred betty barney dino wilma pebbles bamm-bamm);
+@indices = <STDIN>;
+foreach (@indices){
+ print @names[$_-1].(' 'x4);
+}
View
@@ -0,0 +1,8 @@
+# read a list of strings (on separate lines) until end-of-input.
+# Then it should print the strings in code point order. Print it
+# twice on one line style and on separate lines.
+@lines = <STDIN>;
+@lines = sort @lines;
+print @lines;
+chomp(@lines);
+print @lines;

0 comments on commit 7985b47

Please sign in to comment.