I am newbee in perl i want to open this configfile in a perl script. so how to read this config file from a perl script and get the host and port number..
plz help
#!/usr/bin/perl
# read_config.pl
my $filename = shift;
my %host_info = ();
open (CONF_FILE, '<', $filename) or die "Failed to read file $filename : $!";
while (<CONF_FILE>) {
chomp;
next if (m/^$/); # Skip empty lines
next if (m/^\s*#/); # Skip comments
if (m/^(.*?):(\d+)/) {
$host_info{$1} = $2;
}
}
close (CONF_FILE);