SPUG: passing in a reg exp as a string, then interpolating

Aryeh "Cody" Sherr asherr at cs.unm.edu
Fri Jun 9 15:16:26 CDT 2000



>I am passing in a reg exp (like "/^hello/ ")as a string and grabbing it
>(my $regexp = /^hello/ ), and then trying to interpolate:

try this instead:

my $regexp = '^hello$';
push (@results, $k) if /$regexp/;

cody


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 For Subscriptions, Email to majordomo at pm.org:  ACTION  spug-list  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email address





More information about the spug-list mailing list