in reply to Regular expression match in code
A few notes:
my $configFile = "servers.conf"; my (@allServers, @bigArray); # Process file line by line rather than reading all lines into an arra +y # and iterating over the array open (DAT, $configFile); while (my $str = <DAT>) { # the action of your first loop: next if $str =~ /^\w/; # the action of your second loop: my ($server, $ip) = split ("=", $str); $ip =~ s/^\s+//; $ip =~ s/\s+$//; push (@bigArray, $ip . "," . $server); $hashArray{$ip} = $server; } close DAT; my $size = @allServers;
...roboticus
|
|---|