in reply to Re: Replacing text inside lots of files
in thread Replacing text inside lots of files

When I use this example for the problem, I get the error "Modification of a read-only value attempted at -e line 1, <> line 1." and the file is empty. Where do I make a mistake ? I used this example in a DOS-Box of WIN2k and also LINUX. Thanks for helping...
  • Comment on Re: Re: Replacing text inside lots of files

Replies are listed 'Best First'.
Re(3) Replacing text inside lots of files
by delirium (Chaplain) on Nov 03, 2003 at 10:56 UTC
    You may have replaced $l (el) with $1 (one). $1 (one) is a reserved variable for Perl that catches parts of regular expression, and can't be assigned to directly. For example:

    ~/test$ perl -e '$1 = "blah"' Modification of a read-only value attempted at -e line 1.

    Whereas :

    ~/test$ perl -le '$var = "blah"; $var =~ /^(....)$/; print $1' blah