Last active
July 3, 2020 13:15
-
-
Save LadyAleena/42b04e63c764e6c6311d2d6facf8fb51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Text::CSV; | |
use Data::Dumper; | |
my $csv = Text::CSV->new({ | |
sep_char => '|', | |
quote_char => undef, | |
blank_is_undef => 1, | |
empty_is_undef => 1, | |
allow_whitespace => 1, | |
}); | |
$csv->column_names('Weapon','#AT','Dmg(S/M)','Dmg(L)','Range','Weight','Size','Type','Speed','KO','broad group','tight group'); | |
my $fn = 'site/files/data/Role_playing/Reference_tables/Weapons.txt'; | |
open(my $fh, '<', $fn) || die "Can't open $fn. $!"; | |
my $array = $csv->getline_hr_all($fh); | |
my $hash = { | |
map { $_->{"Weapon"} => $_ } @$array | |
}; | |
print Dumper($hash); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment