http://qs321.pair.com?node_id=408740


in reply to Re: RE (tilly) 3: Get default login environment
in thread Get default login environment

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