The pype symbol is a regex metacharacter. If you want to match a literal
"|", you have to escape it with a backslash:
@dataarray = split("\|",$Sentance);
Ravikumar_Tadi wrote:
Hello Listers,
I am currntly working on ARS 4.5. Perl script is unable to identify the pipe Symbol.
open(Datafile, "$Datfile") || die("data file open failed");
foreach $Sentance (<Datafile>)
{
@dataarray = split("|",$Sentance);
print "$dataarray[0]\n";
print "$dataarray[1]\n";
print "$dataarray[2]\n";
}
close(Datafile);
Where $Senctence = ABC|DEF|GHI
When i run this the result is:
A
B
C
But expected result is :
ABC
DEF
GHI
Seems If I replace pipe with " , " ( with comma) it is working.
Please help in this regard ASAP>
Regards,
Ravi Kumar T
DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE
COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact the
sender by email and delete all copies; your cooperation in this regard is
appreciated.
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the Answers
Are"
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the Answers
Are"