#!/usr/bin/perl use strict; my $lamb = 'wolf'; my $text = 'Mary had a little $lamb.'; $text =~ s/(\$\w+)/$1/eeg; print $text . "\n"; # output: Mary had a little wolf.