The %ENV associative array lists the environment variables defined for a program and their values. The environment variables are the array subscripts, and the values of the variables are the values of the array elements.
Source: cat env_variable.pl
#!/usr/bin/perl
$term = $ENV{"TERM"};
print "Terminal you are using: $term \n";
$desktop = $ENV{"DESKTOP_SESSION"};
print "Desktop you are using: $desktop \n";
$lang = $ENV{"LANGUAGE"};
print "Lang you are using: $lang \n";
Output: perl env_variable.pl
Terminal you are using: xterm
Desktop you are using: kde-plasma
Lang you are using: en_US:
#!/usr/bin/perl
$term = $ENV{"TERM"};
print "Terminal you are using: $term \n";
$desktop = $ENV{"DESKTOP_SESSION"};
print "Desktop you are using: $desktop \n";
$lang = $ENV{"LANGUAGE"};
print "Lang you are using: $lang \n";
Output: perl env_variable.pl
Terminal you are using: xterm
Desktop you are using: kde-plasma
Lang you are using: en_US:
0 comments:
Post a Comment