I need to pass a regex substitution as a variable:

```
sub proc {
    my $pattern = shift;
    my $txt = "foo baz";

    $txt =~ $pattern;
}

my $pattern = 's/foo/bar/';
proc($pattern);

```

This, of course, doesn't work. I tried eval'ing the substitution:

```
eval("$txt =~ $pattern;");

```

but that didn't work either. What horribly obvious thing am I missing here?