It was missing a closing bracket just before the ";" in that line. This works:
sub get_login_env { local %ENV; my $shell = shift || (getpwuid($<))[8]; my $env = `echo env | perl -e 'exec {"$shell"} -sh'`; if (wantarray) { my @pieces = ($env =~ m/^(.*?)=((?:[^\n\\]|\\.|\\\n)*)/gm ); s/\\(.)/$1/g foreach @pieces; return @pieces; } else { return $env; } }
Cheers, Sören
In reply to Re^2: RE (tilly) 3: Get default login environment
by Happy-the-monk
in thread Get default login environment
by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |