Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^4: Perl Module Problems

by davidov0009 (Scribe)
on Sep 24, 2006 at 04:06 UTC ( [id://574570]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Perl Module Problems
in thread Perl Module Problems

I have since changed my module because of your suggestions in your previous post. I don't think the error is due to the @$game symbolic reference. I use only the array named @maps in my sub now. Here it is:
use strict; use warnings; use diagnostics; package HLDS; use Exporter (); our $VERSION = 1.00; our @ISA = qw(Exporter); our @EXPORT = (); our @EXPORT_OK = qw(array); # Create Map Array given an argument. sub GameMaps { # Declare Variables my ($game) = @_; my $user = $ENV{'USER'}; # Create Dir Path my $dir = "/home/$user/hlds_l/$game/maps/"; # End if dir not exist return unless -d $dir; #Read maps from directory my @maps; opendir(my $maps_dh, $dir) || die("Cannot open directory"); @maps = readdir($maps_dh); closedir($maps_dh); # Take only maps and trim .bsp @maps=grep /\.bsp/, @$game; foreach my $map (@maps) { $map=~ s/\.bsp// } return @maps; } 1; # end

Replies are listed 'Best First'.
Re^5: Perl Module Problems
by ikegami (Patriarch) on Sep 24, 2006 at 04:17 UTC
    @maps=grep /\.bsp/, @$game; ^^^^^^ should be @maps

    Off-topic, that regexp will accept the file "file.bsp.bak". That's why I added \z to the regexp in my code.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://574570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2024-04-24 14:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found