in reply to Make string that results from split behave like double-quoted string
Something like this should work:
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; while (<DATA>) { chomp; my @ar = split(/\|/ => $_); s/\\n/\n/g for @ar; warn Dumper @ar; } __DATA__ 1|99999|Here comes \n a new line
Edit: the fat arrow in the split is just a personal preference of mine. I find it's easier to look at, though split(/\|/, $_) or split /\|/ work just as fine as well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Make string that results from split behave like double-quoted string
by protist (Monk) on Aug 23, 2013 at 20:11 UTC | |
by chilledham (Friar) on Aug 23, 2013 at 20:22 UTC | |
|
Re^2: Make string that results from split behave like double-quoted string
by knobcreekman (Initiate) on Aug 23, 2013 at 20:56 UTC |