Hi there, I have a script that splits the fileds seperated by a special character. The code works fine when the character is , but does not when I have a textfile seperated by |
My code is as follows. Can anyone give me some hints ?
Thanks
open(FILE, "test.txt") or die "$!";
my $string = <FILE>;
close(FILE);
chomp $string;
my @list = split(/|/,$string);
open(FILE, ">4newfile.txt") or die "$!";
print FILE "$_" for @list;
close(FILE);
My code is as follows. Can anyone give me some hints ?
Thanks
open(FILE, "test.txt") or die "$!";
my $string = <FILE>;
close(FILE);
chomp $string;
my @list = split(/|/,$string);
open(FILE, ">4newfile.txt") or die "$!";
print FILE "$_" for @list;
close(FILE);