Skip to content

Commit d7f4681

Browse files
committed
Perl improvements
1 parent 8bdeb7f commit d7f4681

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

perl/README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
<img src="https://raw.githubusercontent.com/rtoal/polyglot/master/docs/resources/perl-logo-64.png">
22

3-
# Perl
3+
# Perl Explorations
44

5-
## Perl Examples:
5+
To build and run Perl programs on your local machine, visit the [Perl downloads page](https://www.perl.org/get.html). You'll have an opportunity to update your pre-installed Unix or macOS Perl, or fetch a fresh download for Windows (such as [Strawberry Perl](https://strawberryperl.com)).
66

7-
To get Perl:
8-
<details><summary><b>MacOS, Unix</b></summary>
9-
10-
<br />Perl should be already downloaded, type the following to confirm: <br />
7+
Programs in this folder can be run from the command line like so:
118

12-
```sh
13-
$ perl -v
14-
```
15-
</details>
16-
<details><summary><b>Windows</b></summary>
17-
18-
<br />Download Perl using the link below: <br />
19-
20-
- [Strawberry Perl](https://strawberryperl.com)
21-
22-
</details>
9+
```
10+
perl triple.pl
11+
```
2312

24-
## About Perl:
13+
```
14+
perl top_ten_scorers.pl < ../test/wnba_input
15+
```
2516

26-
Perl was created by Larry Wall, with the original intention being to make report processing easier. The language was inspired by other programming languages such as C and C++. It is widely used because of how well it deals with regular expression and string parsing.
17+
To run the tests on a Unix-like shell:
2718

19+
```
20+
./test.sh
21+
```
2822

29-
## Perl Resources:
30-
- [Perl Language Home Page](https://www.perl.org)
23+
## About Perl
3124

32-
- [Perl Docs Page](https://perldoc.perl.org)
25+
Perl was created by Larry Wall, with the original intention being to make report processing easier. The language was inspired by other programming languages such as C and C++. It is widely used because of how well it deals with regular expression and string parsing.
3326

34-
- [W3schools Perl Tutorial](https://www.w3schools.io/languages/perl-tutorials/)
27+
## Perl Resources
3528

29+
- [Language Home](https://www.perl.org)
30+
- [Documentation Page](https://perldoc.perl.org)
31+
- [Perl at Rosetta Code](https://rosettacode.org/wiki/Category:Perl)
32+
- [W3schools Perl Tutorial](https://www.w3schools.io/languages/perl-tutorials/)
3633
- [Perl Programming for Beginners](https://www.simplilearn.com/perl-programming-for-beginners-article#perl_implementation)
37-
3834
- [Perl in 100 Seconds](https://www.youtube.com/watch?v=74_7LrRe5DI)
3935

40-
## Perl Open Source Resources:
36+
## Perl in Open Source
37+
38+
Browse open source activity in Perl at:
4139

42-
Perl is an open source project so feel free to add any contributions!
40+
- [The GitHub Topic Page](https://github.com/topics/perl)
41+
- [Trending Repositories on GitHub](https://github.com/trending/perl)
42+
- [Top 100 Starred Repositories on GitHub](https://github.com/EvanLi/Github-Ranking/blob/master/Top100/Perl.md)
4343

44-
- [Perl Open Source](https://github.com/Perl/perl5)
44+
and note that [Perl itself is open source](https://github.com/Perl/perl5) so please feel free to help out with its development.

perl/binary_search.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# A handcoded binary search, to illustrate some Perl features
1+
# A hand coded binary search, to illustrate some Perl features
22

33
use strict;
44
use warnings;
55
use utf8;
66
use open qw(:std :utf8);
77

88
sub binary_search {
9-
# Arugments are passed as the list @_
9+
# Arguments are passed as the list @_
1010
my ($element_to_find, @ordered_array) = @_;
1111

1212
my $array_length = scalar @ordered_array;

perl/cafe.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@
55
use utf8;
66
use open qw(:std :utf8);
77

8-
%drinks_available = (
8+
my %drinks_available = (
99
"mocha" => 1,
1010
"matcha" => 1,
1111
"tea" => 1
1212
);
1313

14-
%syrups_available = (
14+
my %syrups_available = (
1515
"raspberry" => 1,
1616
"lavender" => 1,
1717
"blueberry" => 1,
1818
"vanilla" => 1
1919
);
2020

2121
print("What drink would you like to order? We have mocha, matcha, and tea.\n");
22-
$customer_drink = <STDIN>;
22+
my $customer_drink = <STDIN>;
2323
chomp($customer_drink);
2424
$customer_drink = lc($customer_drink);
2525

2626
print("Which syrup? We have raspberry, lavender, blueberry, and vanilla.\n");
27-
$customer_syrup = <STDIN>;
27+
my $customer_syrup = <STDIN>;
2828
chomp($customer_syrup);
2929
$customer_syrup = lc($customer_syrup);
3030

perl/test.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/usr/bin/env bash
22
perl binary_search.pl && \
3+
echo 'tea\nlavender\n' | perl cafe.pl && \
34
perl hello.pl && \
5+
perl palindrome.pl && \
46
perl primes.pl 100 && \
57
perl ses.pl && \
68
perl summer.pl && \
7-
perl triple.pl | diff ../test/triple_expected - && \
89
perl top_ten_scorers.pl < ../test/wnba_input | diff ../test/wnba_expected - && \
10+
perl triple.pl | diff ../test/triple_expected - && \
911
perl twice.pl
1012
perl wordcount.pl < ../test/wordcount_input | diff ../test/wordcount_expected - && \
1113

0 commit comments

Comments
 (0)