ok, here's another weird question. i have, in a string, the value (or
nickname) "][v][orpheus". This gets set to $pnick as such:

$pnick = lc(substr($sockstr[0],1));

which then makes $pnick = "][v][orpheus". lower down the procedure, i have
an event,

$chandat{$pchan}->{nicks} =~ s/\b$pnick//;
$chandat{$pchan}->{nicks} =~ s/  / /;

which removes the value of $pnick from the hash $chandat{$pchan}->{nicks}.
now, if the value $pnick has any [ ] { } \ / or |, perl returns an error,
and the program shuts down. i tried to fix this problem with this:

$pnick =~ s/\|/\\\|/g;
$pnick =~ s/\[/\\\[/g;
$pnick =~ s/\]/\\\]/g;
$pnick =~ s/\\/\\\\/g;
$pnick =~ s/\}/\\\}/g;
$pnick =~ s/\{/\\\{/g;

but running all that, returns this error:

 /\b\\]\\[v\\]\\[orpheus/: unmatched [] in regexp at newservice.pl line 292,
<SOCK> line 118.

i can't figure out a way (or regex method) i would use to replace [ with
\[, ] with \], etc.. any clues?

dan

--------------------------------
this is the entire routine
note: at this point:
@sockstr = :nickname PART #channel

__ start __
$pnick = lc(substr($sockstr[0],1));
$pchan = lc($sockstr[2]);
debugmsg("sockstr for part - @sockstr");
$pnick =~ s/\|/\\\|/g;
$pnick =~ s/\[/\\\[/g;
$pnick =~ s/\]/\\\]/g;
$pnick =~ s/\\/\\\\/g;
$pnick =~ s/\}/\\\}/g;
$pnick =~ s/\{/\\\{/g;
$chandat{$pchan}->{nicks} =~ s/\b$pnick//;
$chandat{$pchan}->{nicks} =~ s/  / /;
__ end __



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

Reply via email to