mariaprabudass has asked for the wisdom of the Perl Monks concerning the following question:
I am splitting the record using the delimiter '|'. Encounter a scenario where pipe symbol(delimiter) is preceded by escape sequence,in that case pipe symbol couldn't be consider as a delimiter. How do i resolve it using split? Posted below the sample piece of code
#!/usr/bin/perl use strict; my $id = 'Hi|Hello\|Sir'; my @code = split(/\|/,$id); print $code[1]."\n";
The expected output for the above program is "Hello\|Sir" but the actual output is "**Hello**".How do i handle the delimiter preceded by escape sequence using split.
Thank You
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splitting the record using the delimiter
by kcott (Archbishop) on Sep 30, 2015 at 18:29 UTC | |
|
Re: Splitting the record using the delimiter
by Corion (Patriarch) on Sep 30, 2015 at 18:06 UTC | |
|
Re: Splitting the record using the delimiter
by CountZero (Bishop) on Sep 30, 2015 at 20:22 UTC | |
|
Re: Splitting the record using the delimiter
by KurtSchwind (Chaplain) on Sep 30, 2015 at 18:29 UTC | |
by graff (Chancellor) on Sep 30, 2015 at 23:30 UTC |