On Sun, 26 Aug 2001, Maxim Berlin wrote:
> 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
>
If you're using a regex, like above, I can't really imagine a situation
where you wouldn't know the variable name. Know what I mean?
if you are using s!<variable>!!g, then surely you will know what
<variable> will be, even if you don't know the contents of that variable.
or am I misunderstanding you?
Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]