Great explanation. Now it works well.
Thanks to all and I appreciate all feedbak help.
-Wil

"Bob Showalter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Wil wrote:
> >       @data = split ("\|",$line);
>
> The double quotes are eating the backslash before split sees it. split()
> treats the first arg as a regex (even if you pass it as a string), and the
> pipe char needs to be escaped with a backslash in order to be treated as a
> literal character. What you're doing is equivalent to:
>
>    split(/|/, $line)
>
> which is a regex that matches an empty string. When you pass that kind of
> regex to split(), you will get the input string split up into individual
> characters.
>
> You should write it like:
>
>    split(/\|/, $line)
>
> or
>
>    split('\|', $line)
>
> this will work (but don't do it this way) see why?
>
>    split("\\|", $line)



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to