File tree 4 files changed +65
-0
lines changed
4 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+
4
+ print " content-type: text/html \n\n " ;# HTTP HEADER
5
+
6
+ # DEFINE AN ARRAY
7
+ @coins = (" Quarter" ," Dime" ," Nickel" );
8
+
9
+ # PRINT THE ARRAY
10
+ print " @coins " ;
11
+ print " <br />" ;
12
+ print @coins ;
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+
4
+ print " content-type: text/html \n\n " ;# HTTP HEADER
5
+
6
+ # DEFINE AN ARRAY
7
+ @coins = (" Quarter" ," Dime" ," Nickel" );
8
+
9
+ # PRINT THE ARRAY
10
+ print " @coins " ;
11
+ print " <br />" ;
12
+ print @coins ;
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl -w
2
+
3
+ $one = 0;
4
+ $two = 0;
5
+
6
+ print ' Enter a range boundry: ' ;
7
+ chomp ($one = <STDIN >);
8
+ print ' Enter the other range boundry: ' ;
9
+ chomp ($two = <STDIN >);
10
+
11
+ if ($one < $two ) {
12
+ @array = ($one .. $two );
13
+ } else {
14
+ @array = ($two .. $one );
15
+ }
16
+
17
+ print " @array \n " ;
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+ # Script which prompt you for two arrays and then creates a third array that contains only the element prenset in the first two( the intersection of those arrays
3
+
4
+ $in = ' ' ; # temo input
5
+ @array1 = ();
6
+ @array2 = ();
7
+ @final = ();
8
+
9
+ print ' Enter the first array: ' ;
10
+ chomp ($in = <STDIN >);
11
+ @array1 = split (' ' , $in );
12
+ print ' Enter the second array: ' ;
13
+ chomp ($in = <STDIN >);
14
+ @array2 = split (' ' , $in );
15
+
16
+ foreach $el (@array1 ) {
17
+ foreach $el2 (@array2 ) {
18
+ if (defined $el2 && el eq $el2 ) {
19
+ $final [$#final +1];
20
+ undef el2;
21
+ last ;
22
+ }
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments