in reply to split() help
'(' and ')' are magic characters in a regex so need to be quoted if you want a literal match for them. One way to do it is use the quote meta sequence. Consider:
use strict; use warnings; my $data = <<DATA; DataAchr(9)DataBchr(9)DataC DATA open my $infile, '<', \$data; while (<$infile>) { chomp; my $re = 'chr(9)'; my @array= split(/\Q$re\E/,$_); print "@array\n"; } close $infile;
Prints:
DataA DataB DataC
|
|---|