Martin, I'm not entirely clear on what you're trying to do here, so if this doesn't help, let me know and I'll try again.
I think the problem is that you're doing this: s/$ARGV[0]/\($ARGV[0]\)/g ...when you want to affect $ARGV[0]. But remember that s/// and m// are, by default, applied to the contents of the $_ variable. So, when Perl sees that line of code above, it effectively rewrites it to be: $_ =~ s/$ARGV[0]/\($ARGV[0]\)/g; Which, in English, means something like this: "Go through the string stored in the $_ variable. Look for a substring which is identical to the string stored in $ARGV[0]. If you find it, replace it with that same string with parens around it. Finally, because there is a 'g' option on the operation, do not stop after finding the first match; continue through the contents of $_ and replace any other matches you find." I think what you want instead is this: $ARGV[0] = "($ARGV[0])"; Dave On Sun, 4 Nov 2001, Martin Karlsson wrote: > Could anyone please show me the way to think here? > > If I execute a script with an argument, e.g monkey, then monkey will be > found in $ARGV[0]. If I then want to highlight the word monkey by > putting it in parentheses, i thought something like > s/$ARGV[0]/\($ARGV[0]\)/g > would do the trick; however it won't. > > Thanks, > -- > ------------------------------------------------ > Martin Karlsson [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]