package MAP; use diagnostics; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.00; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(array); # Create Map Array given an argument. sub array { # Declare Variables my $game = @_; my $user = $ENV{'USER'}; # Create Dir Path my $dir = "/home/$user/hlds_l/$game/maps/"; #Read maps from directory if (-d $dir) { opendir(MAPS, $dir) || die("Cannot open directory"); @$game= readdir(MAPS); closedir(MAPS); # Take only maps and trim .bsp @$game=grep /\.bsp/, @$game; my $map; foreach $map (@$game) { $map=~ s/\.bsp// } } return (@$game); } 1; # end