#!/usr/bin/perl use strict; use warnings; my $content = do{ local $/; }; our $foo = 'hallo'; no strict; $content =~ s/\$(\w+)/${$1}/eg; print $content; __END__ text text $foo text $foo text