$pat4 = $envment . "REQ_*.req.copied"; ... $ls4 = $sftp->ls('/', names_only => 1, wanted=>qr/$pat4/);