in reply to Re: Splitting the record using the delimiter
in thread Splitting the record using the delimiter

This is a case for a negative look-behind assertion:
#!/usr/bin/perl use strict; my $id = 'Hi|Hello\|Sir'; my @code = split(/(?<!\\)\|/,$id); print $code[1]."\n";
UPDATE: Sorry, I should have realized that I just repeated what kcott said in the previous reply.