in reply to how perl do 'envsubst'

I don't know what envsubst does and why you need it. Please explain.

Anyway you can set environment variables inside the %ENV hash, and all subprocesses will inherit them.

If your real problem is to parse your config file, please show us its format.

I once published a hack to read the ENV of a subprocess, it's listed in my home node, but I'm not sure if that's what you need.

Update

Sigh, envsubst seems to be a template system based on variable interpolation.

This should do the trick already

my $KBDCFG = qq~ input (device-file "$KBD_DEV") ~

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery