in reply to passing regular expression

Just like any other argument, really.

For creating the regex object it helps to use the qr{...} quoting construct:

my $re = qr{^yikes}i; your_sub($re, $other, $arguments);
Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: passing regular expression
by karthikasasanka (Acolyte) on Oct 09, 2009 at 06:37 UTC
    thank you, Is it possible to write a subroutine which can take regular expression like split function does.
    @a = split(/ /,"this is a string");
      I don't think that's possible for non-builtin functions. If it is, it might work with a prototype, see perlsub.