sorry detlef - ill post more elaborate in the future
your answer to my question is what i wanted - im not sure the qoutes really
are needed in the regexp though
thanks
allan
-----Oprindelig meddelelse-----
Fra: Detlef Lindenthal [mailto:[EMAIL PROTECTED]]
Sendt: Thursday, June 21, 2001 11:59 AM
Til: Allan Juul
Cc: '[EMAIL PROTECTED]'
Emne: Re: [MacPerl] replace numbers
=Hi Allan,
<complain>
can you imagin that it is rather a big effort
to guess what you want to express?
Some advices:
1. It would be a good practice for you to
start using capital letters. You have paid for
them, so use them!
2. Post a complete script containing
TEST DATA!!! This means:
start your script with a line like this:
$_ = "my test data: bla bla bla ... ";
3. Then end your question with a line like this:
## my desired result: "stuff23"
3. Read your question again and once again
before posting it.
See: all this what I am writing is
a ready-to-run Perl script, although it does
contain only 3 lines of Perl code.
</complain>
Do you think of something like this?
=cut
$_ = "some stuff";
s/some (stuff)/$1."23"/ge;
print; ## will print: "stuff23"
=o
Allan wrote:
> hi
> might be silly question
> how do you actually replace numbers when
> immidialtely following a $1, $2 or so?
> like this will return stuff23 :
> $a = 23;
> $_ =~ s/some (stuff)/$1$a/g
> i had hoped something in the vein of this
> would have done it:
> $_ =~ s/some (stuff)/$1\23/g
> thanks
> allan