aboutsummaryrefslogtreecommitdiff
path: root/challenge-161/alexander-pankoff/perl/DictReader.pm
blob: e1dd09f7490f7e3719c703832ff6eb28d30f5c8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package DictReader;
use strict;
use warnings;
use autodie;
use feature qw'say state signatures';
no warnings qw'experimental::signatures';

use FindBin    ();
use File::Spec ();

use Exporter qw(import);

our @EXPORT_OK = qw(read_dict);

use constant DICTIONARY =>
  File::Spec->catfile( $FindBin::RealBin, qw/.. .. .. data dictionary.txt/ );

sub read_dict() {
    my @dict = slurp(DICTIONARY);
}

sub slurp($file) {
    open( my $fh, '<', $file );
    chomp( my @in = <$fh> );
    close $fh;
    return @in;
}

1;