How do I set environment variables in Perl programs?
Submitted by: Administratoryou can just do something like this:
$ENV{'PATH'} = '...';
As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables.
Because %ENV is a hash, you can set environment variables just as you'd set the value of any Perl hash variable. Here's how you can set your PATH variable to make sure the following four directories are in your path::
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin';
Submitted by: Administrator
$ENV{'PATH'} = '...';
As you may remember, "%ENV" is a special hash in Perl that contains the value of all your environment variables.
Because %ENV is a hash, you can set environment variables just as you'd set the value of any Perl hash variable. Here's how you can set your PATH variable to make sure the following four directories are in your path::
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/home/yourname/bin';
Submitted by: Administrator
Read Online Perl Programming Job Interview Questions And Answers
Top Perl Programming Questions
☺ | How do you give functions private variables that retain their values between calls? |
☺ | How many ways can we express string in Perl? |
☺ | How do you match one letter in the current locale? |
☺ | How do I set environment variables in Perl programs? |
☺ | How to open and read data files with Perl |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |