linux poison RSS
linux poison Email

Perl Script: Read the Environment Variables

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

$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
Terminal you are using: xterm
Desktop you are using: kde-plasma
Lang you are using: en_US:


Post a Comment

Related Posts with Thumbnails