http://qs321.pair.com?node_id=228269

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi I'm trying to get a regular expression to pass the results of a regular expression substitution into a method argument. Rather than just make a temporary variable and do the substitution on that, and then pass that to the function, is there any way I can do the substitution as part of the argument list, eg:
$word = 'BLAHBLAH'; print blah(s/BLAH/COW/); print "$word\n"; sub blah { my $stuff = shift; print "$stuff\n"; }
I want to keep the blah method as general as possible, and don't want to add the regular expression there. This is purely a style issue (as I think something like this would look much nicer than having to use one-off variables)