HI All ,
I am facing an interesting problem
Please help me resolve the same.
I have two functions. The main function reads the machine name from an input config file , passes it on to sub_main() function .
In the sub_main() function , I need to concatenate this machine name with ".world" .
However the concatenated string is wierd. However both the inpus to the concatenation are OK , the result is not
Please Help
Attaching code for your reference.
#!/usr/bin/perl
main();
sub main () {
my %config_hash=();
my @machines=();
my $i=0;
open(CONFIG, "<config_details.cfg") || die "I/O Success - Cannot process get_max_ri.sql file";
while (<CONFIG>)
{
my @config_line=split(/=/,$_);
print "$config_line[0]\n";
$config_hash{$config_line[0]}=$config_line[1];
}
@machines=split(/,/,$config_hash{"MACHINE NAMES"});
my $NUM_MACHINES=@machines;
for ($i=0;$i<$NUM_SMF_MACHINES;$i++)
{
chomp($machines[$i]);
sub_main($i+1,$machines[$i]);
}
}
sub sub_main()
{
my $mac2=shift();
my $mac3=$mac2.'.world';
print $mac3;
print "\n";
}
I am facing an interesting problem
Please help me resolve the same.
I have two functions. The main function reads the machine name from an input config file , passes it on to sub_main() function .
In the sub_main() function , I need to concatenate this machine name with ".world" .
However the concatenated string is wierd. However both the inpus to the concatenation are OK , the result is not
Please Help
Attaching code for your reference.
#!/usr/bin/perl
main();
sub main () {
my %config_hash=();
my @machines=();
my $i=0;
open(CONFIG, "<config_details.cfg") || die "I/O Success - Cannot process get_max_ri.sql file";
while (<CONFIG>)
{
my @config_line=split(/=/,$_);
print "$config_line[0]\n";
$config_hash{$config_line[0]}=$config_line[1];
}
@machines=split(/,/,$config_hash{"MACHINE NAMES"});
my $NUM_MACHINES=@machines;
for ($i=0;$i<$NUM_SMF_MACHINES;$i++)
{
chomp($machines[$i]);
sub_main($i+1,$machines[$i]);
}
}
sub sub_main()
{
my $mac2=shift();
my $mac3=$mac2.'.world';
print $mac3;
print "\n";
}