Hi Guys, I have this script which reads this text file and splits each line based on comma operator.The strange thing is it is removing the last character from the last word in the last line.So it is not displayed completely. Can anybody tell me why its so ?
Any help will be greatly appreciated ? Thanx, Alok. #!/usr/bin/perl $testFile = "TestTemplates.txt" ; open(DATA, $testFile) || die "Unable to open file" ; @test = <DATA> ; foreach $val (@test) { chop ($val) ; ($val1, $val2) = split(/\,/,$val) ; print "val1 = $val1 \n" ; print "val2 = $val2 \n" ; } close (DATA) ; exit 0 ; TestRemplates.txt iteration8H.SampleServiceDesign_test.xml,create iteration8H.SampleServiceDesign_test.png,test iteration8H.SampleServiceDesign_test.xml,delete123 Output : val2 = create val1 = iteration8H.SampleServiceDesign_test.png val2 = test val1 = iteration8H.SampleServiceDesign_test.xml val2 = delete12esign_test.xml,delete12