At 11:38 AM 11/4/01 -0800, Wagner-David wrote:
>         If you only want to place parens around the input, then you can 
> just place it parans like:
>                 $ARGV[0] = '(' . $ARGV[0] . ')';

Somewhat clearer:

         $ARGV[0] = "($ARGV[0])";

>         In your original code, you want to work with $ARGV[0] but the 
> regex w/o inputs assumes:
>
>         $_ =~ s/$ARGV[0]/\($ARGV[0]\)/g;
>           which is not what you are after.
>
>         If you really want the regex then:
>
>    $ARGV[0] =~ s/$ARGV[0]/\($ARGV[0]\)/g;
>         would work for you.

Not always, if $ARGV[0] contained regex metacharacters.  And those \s are 
unnecessary.  Much better:

         $ARGV[0] =~ s/(.*)/($1)/s;


--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com


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

Reply via email to