in reply to Shift returning pointer

What bellaire said; and to see what's in there, try

print ref $environment eq 'ARRAY' ? join(', ', map { "'$_'" } @$environment) : $environment;