#!/usr/bin/perl use strict; my $id = 'Hi|Hello\|Sir'; my @code = split(/\|/,$id); print $code[1]."\n";