SPUG: Anyone savvy in this?

Ben Reser ben at reser.org
Wed Jan 30 13:04:38 CST 2002


On Wed, Jan 30, 2002 at 10:31:09AM -0800, Chris Wilkes wrote:
> Now I have a question about this, what if she said
> 	$br = "< br />";
> 	$row[4] =~ s/$br/somethinghere/g;
> Why doesn't that blow up?  Good thing I checked this, I thought it did
> gives problems in previous versions of perl and was going to ask how to
> get around it. 

Because the parser knows what you mean.  You can't do:
$x = "print 'this';"
$x;

So why would it expand before executing the pattern?

Frankly if you want to do something with /'s in it you should be doing
something like this:
s#<br />#\n#g;
or whatever other delimeter you want that is compatable with your
pattern.
:)

-- 
Ben Reser <ben at reser.org>
http://ben.reser.org

What difference does it make to the dead, the orphans, and the homeless,
whether the mad destruction is wrought under the name of totalitarianism
or the holy name of liberty and democracy? - Ghandi

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org





More information about the spug-list mailing list