#!/usr/bin/perl -w
use strict;
use POSIX qw(setsid);

my $pid = fork();
my $language = "";
my $region = "";
my $values1 = "";

if ($pid) # parent
{
    exit(0);
}
elsif ($pid == 0) # child
{
    setsid();
    my $data = $ENV{LANG};
    my @env1 = split('\.', $data);
    my $counter1 = 1;
    foreach $values1 (@env1)
    {
       if ($counter1 == 1)
       {
          $counter1 = 2;
          my @env2 = split('_', $values1);
          my $counter2 = 1;
          foreach my $values2 (@env2)
          {
             if ($counter2 == 1)
             {
               $language = $values2;
               $counter2 = 2;
             }
             else
             {
               $region = $values2;
             }

          }
       }
    }
    system("$ARGV[0] $language $region" );
    exit(0);
}
else
{
    die "Unable to fork process: $!\n";
}
