Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use Cwd qw(cwd);
- my $dir = cwd;
- print "$dir\n";
- my $filename = "$dir/data/adzuna.html";
- my $counter = 1;
- my $content;
- open(my $fh, '<', $filename) or die "cannot open file";
- {
- local $/;
- $content = <$fh>;
- }
- close($fh);
- my @countries;
- my @sorted_countries;
- @countries = ( $content =~ /<a href="https:\/\/www\.adzuna\.\w+\.?\w*">([^<]+?)<\/a>/g );
- @sorted_countries = sort { lc($a) cmp lc($b) } @countries;
- foreach my $country (@countries)
- {
- print "$counter:";
- if ( length($country) < 4 )
- {
- print "$country\t\t$sorted_countries[$counter-1] \n";
- }
- else
- {
- print "$country\t$sorted_countries[$counter-1] \n";
- }
- $counter++;
- }
- 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement