use strict;

my %l_variables;

$l_variables{LD_LIBRARY_PATH}="$ENV{LD_LIBRARY_PATH}:$ENV{HOME}/lib/:$ENV{HOME}/lib/lib/";
$l_variables{PERL5LIB}="$ENV{HOME}/perl/lib";
$l_variables{MANPATH}="$ENV{HOME}/perl/share/man:$ENV{HOME}/perl/man:".`manpath`;

sub var_to_csh( $$ ){
  my $in_file_name=shift;
  my $in_vars=shift;
  my $i;

  open FILE,">$in_file_name" or die "Could not create $in_file_name: $!\n";

  for $i (keys %{$in_vars}){
    print FILE << "EOLN" 
      setenv $i $in_vars->{$i}
EOLN
  }
}
sub var_to_sh( $$ ){
  my $in_file_name=shift;
  my $in_vars=shift;
  my $i;

  open FILE,">$in_file_name" or die "Could not create $in_file_name: $!\n";

  for $i (keys %{$in_vars}){
    print FILE << "EOLN"
$i=$in_vars->{$i}
export $i
EOLN
  }
}

var_to_sh("env.sh",\%l_variables);
var_to_csh("env.csh",\%l_variables);
