in reply to Re: regex substitution
in thread regex substitution
Perhaps it shouldn't work without /e, but it does, at least with activestate perl 5.6.1. (obviously, you should use strict and warnings...)
#!perl $_="this is a #fish#\n"; $a{"fish"}="test"; print; s/#(\w+)#/$a{$1}/; print; this is a #fish# this is a test C:\perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 626 provided by ActiveState Tool Corp. http://www.ActiveS +tate.com Built 01:31:15 May 2 2001
|
---|
Replies are listed 'Best First'. | |
---|---|
(crazyinsomniac) Re^3: regex substitution
by crazyinsomniac (Prior) on Nov 05, 2001 at 13:03 UTC |
In Section
Seekers of Perl Wisdom