Hello Christopher,

Sunday, August 26, 2001, Christopher Solomon <[EMAIL PROTECTED]> wrote:

>> >> >> p.s. does anyone know, why i can not write "$a =~ s/$///g;" ?
>> >> 
>> >> CS> You can. 
>> >> 
>> >> CS> $a =~ s!$/!!g;
>> >> 
>> >> CS> Perl just gets confused with the /'s, you have to use alternate
>> >> CS> delimiters.
>> >> ok, what about "$!" ? use @? what about "$@"?
>> >> and so on...
>> 
>> CS> I guess just use whatever delimiters won't get caught up in the variable
>> CS> name.  You can use (I believe) any non-alphanumeric character as a regex
>> CS> delimiter.  I like !, /, ^, and {} personally.
>> :) what if i don't know variable name?
>> 
>> $! is $OS_ERROR, $ERRNO
>> $/ is $INPUT_RECORD_SEPARATOR, $RS
>> $^ is $FORMAT_TOP_NAME
>> 

CS> If you're using a regex, like above, I can't really imagine a situation
CS> where you wouldn't know the variable name. Know what I mean?
yes.

CS> if you are using s!<variable>!!g, then surely you will know what  
CS> <variable> will be, even if you don't know the contents of that variable.
no.

CS> or am I misunderstanding you?

may be.
example:

$regex=<STDIN>; chomp $regex;
$variable=<STDIN>; chomp $variable;
$a =~ s!$variable!$regex!;

any ideas?

Best wishes,
 Maxim                            mailto:[EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to