> "Bob Showalter" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
> > You should write it like:
> >
> >split(/\|/, $line)
> >
> > or
> >
> >split('\|', $line)
> >
> > this will work (but don't do it this way) see why?
> >
> >split("\\|", $line)
I don't see why you shoul
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()
>
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'
On Jul 6, Wil said:
> @data = split ("\|",$line);
The double-quoted string "\|" is equal to "|". You have gained nothing
with your backslash, because it was used by the double quotes, and never
got to the regex engine.
| is a regex metacharacter. split() takes a regex as its first argumen
On Jul 7, [EMAIL PROTECTED] said:
>Try using in the following way,
>$DELIM_PIPE = '|';
>@data = split /[$DELIM_COMMA]/,$line;
You used different variable names. And this won't work in all cases.
>@data = split /['|']/,$line;
That splits on a | or a ' character, which is not is intended.
--
J
Hi,
Try using in the following way,
$DELIM_PIPE = '|';
@data = split /[$DELIM_COMMA]/,$line;
or
@data = split /['|']/,$line;
Regards
Suresh
-Original Message-
From: Wil [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 07, 2004 2:39 AM
To: [EMAIL PROTECTED]
Subject:
On Jul 6, 2004, at 4:09 PM, Wil wrote:
Dear Folks,
I'm trying to split a line that contains a pipe "|" and I cann't find
a way
how to do it. If i put a back slash "\", it doesn't work either. Can
somebody help me how to do it?
There's really nothing wrong with your code, so the problem is
somethi
-Original Message-
From: Wil [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 06, 2004 4:09 PM
To: [EMAIL PROTECTED]
Subject: Split the line with "|" character
Dear Folks,
I'm trying to split a line that contains a pipe "|" and I cann't find a
way how t
Dear Folks,
I'm trying to split a line that contains a pipe "|" and I cann't find a way
how to do it. If i put a back slash "\", it doesn't work either. Can
somebody help me how to do it?
My code is :
while ($line = ) {
chomp $line;
@data = split ("\|",$line);
..
}
Thanks
Wi