On Fri, 3 Aug 2001, Darren Edgerton wrote:

> What i really want to do is use a variable to contain the pipe
> ie
>     my $separator = "|";
>     my @arr = split(/$separator/,$somevar);
>
>     Now:
>         $arr[0] = "h"
>         $arr[1] = "e"
>
> How do i get the split command to use $separator correctly ??

The problem is that | is a pattern metacharacter (to separate
alternatives), and still needs to be escaped, since the regexp in the
argument list can accept an expression for dynamically generated runtime
patterns.  If you want to match on |, you need to escape it.

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Prediction is very difficult, especially of the future.
- Niels Bohr


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

Reply via email to