Good morning,
You'd have to format the split builtin differently, and you'd have to
escape the |.
Furthermore, you'd have to chomp the line before you edit it (there is
still a linebreak on the end of the line).
$datafile = "test.txt";
open(datafile, "$datafile") || die("Error opening $datafile: $!\n");
foreach $line (<datafile>)
{
chomp $line;
@dataarray = split(/\|/,$line);
print "$dataarray[0]\n";
print "$dataarray[1]\n";
print "$dataarray[2]\n";
}
close(datafile);
btw: this is not a real Remedy related issue I guess ;-)
--
Met vriendelijke groet / Kind regards
Michiel Beijen
______________________________________________________
MANSOLUTIONS
Energieweg 60-62
3771 NA Barneveld
The Netherlands
Tel. +31-(0)612968592
Mail [EMAIL PROTECTED]
Internet http://bsm.mansolutions.nl
On 4/2/07, Ravikumar_Tadi <[EMAIL PROTECTED]> 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"