Programming-Idioms

History of Idiom 205 > diff from v4 to v5

Edit summary for version 5 :
[Perl] Apply name change env -> foo

Version 4

2019-09-29, 19:11:09

Version 5

2019-09-29, 19:12:01

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Imports
use 5.010; # for // operator
Imports
use 5.010; # for // operator
Code
my $env = $ENV{FOO} // 'none';
Code
my $foo = $ENV{FOO} // 'none';
Doc URL
http://p3rl.org/var#%ENV
Doc URL
https://perldoc.pl/perlvar#%ENV